@Test public void testBufferPositionCorrect() throws IOException { // Fill bytes byte[] bytes = new byte[1024]; random.nextBytes(bytes); ByteArrayImageInputStream input = new ByteArrayImageInputStream(bytes); input.readByte(); input.readByte(); input.skipBytes(124); input.readByte(); input.readByte(); // Sanity check assertEquals(128, input.getStreamPosition()); BufferedImageInputStream stream = new BufferedImageInputStream(input); assertEquals(input.getStreamPosition(), stream.getStreamPosition()); stream.skipBytes(128); //assertTrue(256 <= input.getStreamPosition()); assertEquals(256, stream.getStreamPosition()); stream.seek(1020); assertEquals(1020, stream.getStreamPosition()); }
public void testBufferPositionCorrect() throws IOException { // Fill bytes byte[] bytes = new byte[1024]; mRandom.nextBytes(bytes); ByteArrayImageInputStream input = new ByteArrayImageInputStream(bytes); input.readByte(); input.readByte(); input.skipBytes(124); input.readByte(); input.readByte(); // Sanity check assertEquals(128, input.getStreamPosition()); BufferedImageInputStream stream = new BufferedImageInputStream(input); assertEquals(input.getStreamPosition(), stream.getStreamPosition()); stream.skipBytes(128); //assertTrue(256 <= input.getStreamPosition()); assertEquals(256, stream.getStreamPosition()); stream.seek(1020); assertEquals(1020, stream.getStreamPosition()); }
public void testBufferPositionCorrect() throws IOException { // Fill bytes byte[] bytes = new byte[1024]; random.nextBytes(bytes); ByteArrayImageInputStream input = new ByteArrayImageInputStream(bytes); input.readByte(); input.readByte(); input.skipBytes(124); input.readByte(); input.readByte(); // Sanity check assertEquals(128, input.getStreamPosition()); BufferedImageInputStream stream = new BufferedImageInputStream(input); assertEquals(input.getStreamPosition(), stream.getStreamPosition()); stream.skipBytes(128); //assertTrue(256 <= input.getStreamPosition()); assertEquals(256, stream.getStreamPosition()); stream.seek(1020); assertEquals(1020, stream.getStreamPosition()); }