Пример #1
0
 private byte[] read(byte[] data, int pos) throws IOException {
   ByteArrayOutputStream out = new ByteArrayOutputStream();
   ByteArrayInputStream bis = new ByteArrayInputStream(data);
   Header header = new Header();
   header.read(data, pos);
   bis.skip(pos + header.getSize());
   InflaterInputStream inflater = new InflaterInputStream(bis);
   byte[] chunk = new byte[4096];
   int count;
   while ((count = inflater.read(chunk)) >= 0) {
     out.write(chunk, 0, count);
   }
   inflater.close();
   return out.toByteArray();
 }