@Test public void testNegativeNumber() throws IOException { Encoder encoder = new SinglePrecisionEncoder(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); float value = -7.101f; encoder.encode(value, baos); encoder.encode(value - 2, baos); encoder.encode(value - 4, baos); encoder.flush(baos); encoder.encode(value, baos); encoder.encode(value - 2, baos); encoder.encode(value - 4, baos); encoder.flush(baos); ByteBuffer buffer = ByteBuffer.wrap(baos.toByteArray()); for (int i = 0; i < 2; i++) { Decoder decoder = new SinglePrecisionDecoder(); if (decoder.hasNext(buffer)) { assertEquals(value, decoder.readFloat(buffer), delta); } if (decoder.hasNext(buffer)) { assertEquals(value - 2, decoder.readFloat(buffer), delta); } if (decoder.hasNext(buffer)) { assertEquals(value - 4, decoder.readFloat(buffer), delta); } } }
@Override public boolean hasNext(ByteBuffer buffer) throws IOException { if (buffer.remaining() > 0 || !isEnd) { return true; } return false; }
GorillaDecoder extends Decoder { @Override public boolean hasNext(ByteBuffer buffer) throws IOException { if (buffer.remaining() > 0 || !isEnd) { return true; } return false; } }
GorillaDecoder extends Decoder { @Override public boolean hasNext(ByteBuffer buffer) throws IOException { if (buffer.remaining() > 0 || !isEnd) { return true; } return false; } GorillaDecoder(); }
GorillaDecoder extends Decoder { @Override public boolean hasNext(ByteBuffer buffer) throws IOException { if (buffer.remaining() > 0 || !isEnd) { return true; } return false; } GorillaDecoder(); @Override void reset(); @Override boolean hasNext(ByteBuffer buffer); }
GorillaDecoder extends Decoder { @Override public boolean hasNext(ByteBuffer buffer) throws IOException { if (buffer.remaining() > 0 || !isEnd) { return true; } return false; } GorillaDecoder(); @Override void reset(); @Override boolean hasNext(ByteBuffer buffer);  }