Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void onClick(View v) {
- WebServiceC webService = WebServiceC();
- epubDownloaded = webService.downloadEpub(publi.getId());
- File fileEpub=new File(Environment.getExternalStorageDirectory(), "test.epub");
- if (fileEpub.exists()) {
- fileEpub.delete();
- }
- try {
- FileOutputStream fos=new FileOutputStream(arquivoEpub.getPath());
- fos.write(epubDownloaded);
- fos.close();
- }catch (IOException e) {
- e.printStackTrace();
- }
- }
- });
- int count;
- WebServiceC webService = new WebServiceC();
- epubDownloaded = webService.downloadEpub(publi.getId());
- InputStream input = new ByteArrayInputStream(epubDownloaded);
- OutputStream output = null;
- try {
- output = new FileOutputStream(Environment.getExternalStorageDirectory()+"/test.epub");
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- }
- byte data[] = new byte[1024];
- try {
- while ((count = input.read(data)) != -1) {
- output.write(data, 0, count);
- }
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement