I am reading a large zip file but my code giving me negative array size exception
// Simplest read of an entire file into a byte array
// Will throw exceptions for file not found etc.
private static byte[] loadFileAsByteArray(String path) throws IOException {
File file = new File(path);
InputStream is = new FileInputStream(file);
byte[] data = new byte[(int) file. Length()];
is.read(data);
return data;
}
Please tell me how I can read a long zip file data in bytes