@Test(expected=IOException.class) public void testGzipDecompressText() throws IOException { byte[] uncompressed = new byte[] {65, 66, 67, 68, 10}; ReaderUtils.deflateGzip(uncompressed); }
public static byte[] deflateGzip(byte[] inputBytes) throws IOException { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); try (GZIPInputStream gzipInputStream = new GZIPInputStream( new ByteArrayInputStream(inputBytes))) { byte[] buffer = new byte[BYTE_BUFFER_CHUNK_SIZE]; while (gzipInputStream.available() == 1) { int size = gzipInputStream.read(buffer); if (size == -1) { break; } byteArrayOutputStream.write(buffer, 0, size); } return byteArrayOutputStream.toByteArray(); } }
ReaderUtils { public static byte[] deflateGzip(byte[] inputBytes) throws IOException { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); try (GZIPInputStream gzipInputStream = new GZIPInputStream( new ByteArrayInputStream(inputBytes))) { byte[] buffer = new byte[BYTE_BUFFER_CHUNK_SIZE]; while (gzipInputStream.available() == 1) { int size = gzipInputStream.read(buffer); if (size == -1) { break; } byteArrayOutputStream.write(buffer, 0, size); } return byteArrayOutputStream.toByteArray(); } } }
ReaderUtils { public static byte[] deflateGzip(byte[] inputBytes) throws IOException { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); try (GZIPInputStream gzipInputStream = new GZIPInputStream( new ByteArrayInputStream(inputBytes))) { byte[] buffer = new byte[BYTE_BUFFER_CHUNK_SIZE]; while (gzipInputStream.available() == 1) { int size = gzipInputStream.read(buffer); if (size == -1) { break; } byteArrayOutputStream.write(buffer, 0, size); } return byteArrayOutputStream.toByteArray(); } }  }
ReaderUtils { public static byte[] deflateGzip(byte[] inputBytes) throws IOException { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); try (GZIPInputStream gzipInputStream = new GZIPInputStream( new ByteArrayInputStream(inputBytes))) { byte[] buffer = new byte[BYTE_BUFFER_CHUNK_SIZE]; while (gzipInputStream.available() == 1) { int size = gzipInputStream.read(buffer); if (size == -1) { break; } byteArrayOutputStream.write(buffer, 0, size); } return byteArrayOutputStream.toByteArray(); } }  static MmtfStructure getDataFromUrl(String pdbId); static MmtfStructure getDataFromUrl(String pdbId, boolean https, boolean reduced); static byte[] getByteArrayFromUrl(String pdbId); static byte[] getByteArrayFromUrl(String pdbId, boolean https, boolean reduced); static byte[] deflateGzip(byte[] inputBytes); static MmtfStructure getDataFromFile(Path filePath); static MmtfStructure getDataFromInputStream(InputStream inStream); }
ReaderUtils { public static byte[] deflateGzip(byte[] inputBytes) throws IOException { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); try (GZIPInputStream gzipInputStream = new GZIPInputStream( new ByteArrayInputStream(inputBytes))) { byte[] buffer = new byte[BYTE_BUFFER_CHUNK_SIZE]; while (gzipInputStream.available() == 1) { int size = gzipInputStream.read(buffer); if (size == -1) { break; } byteArrayOutputStream.write(buffer, 0, size); } return byteArrayOutputStream.toByteArray(); } }  static MmtfStructure getDataFromUrl(String pdbId); static MmtfStructure getDataFromUrl(String pdbId, boolean https, boolean reduced); static byte[] getByteArrayFromUrl(String pdbId); static byte[] getByteArrayFromUrl(String pdbId, boolean https, boolean reduced); static byte[] deflateGzip(byte[] inputBytes); static MmtfStructure getDataFromFile(Path filePath); static MmtfStructure getDataFromInputStream(InputStream inStream);  }