protected byte[] uncompressBlockUsingStream(InputStream in) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(_compressed.length); byte[] buffer = new byte[4000]; int count; while ((count = in.read(buffer)) >= 0) { out.write(buffer, 0, count); } in.close(); out.close(); return out.toByteArray(); }
protected byte[] loadFile(File file) throws IOException { FileInputStream in = new FileInputStream(file); ByteArrayOutputStream out = new ByteArrayOutputStream((int) file.length()); byte[] buffer = new byte[4000]; int count; while ((count = in.read(buffer)) > 0) { out.write(buffer, 0, count); } in.close(); out.close(); return out.toByteArray(); }
protected byte[] compressBlockUsingStream(byte[] uncompressed) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(uncompressed.length); compressToStream(uncompressed, out); return out.toByteArray(); }