Java apache IOUtils: how to delete a file after read it into a byte array? -
so trying read file byte array using apache mutual library, , delete file itself. cannot it. can allow me know why?
file afile = new file("path_to_a_pdf_file"); byte[] filebytes = ioutils.tobytearray(new fileinputstream(afile)); boolean result = afile.delete(); system.out.println("is file " + afile.getabsolutepath() + " deleted? " + result);
how delete file? thanks
you have close stream opened by: new fileinputstream(afile)
java
No comments:
Post a Comment