PgxProductReader extends AbstractProductReader { static Header readHeader(ImageInputStream stream) throws IOException { byte[] buffer = new byte[64]; stream.read(buffer); String header = new String(buffer).split("\n")[0]; return parseHeaderLine(header); } PgxProductReader(PgxProductReaderPlugIn readerPlugIn); @Override void close();  }
@Test public void testHeaderParsingFromStream() throws IOException { String content = "PG ML + 16 10960 4096\nfurther, unneeded content"; BufferedInputStream stream = new BufferedInputStream(new ByteArrayInputStream(content.getBytes())); final PgxProductReader.Header header = PgxProductReader.readHeader(new MemoryCacheImageInputStream(stream)); assertNotNull(header); assertEquals(ByteOrder.BIG_ENDIAN, header.byteOrder); assertEquals(false, header.signed); assertEquals(16, header.bitDepth); assertEquals(10960, header.width); assertEquals(4096, header.height); }