@Test public void testEnsureSpaceForKey() { BufferedDataBlockEncoder.SeekerState state = new BufferedDataBlockEncoder.SeekerState( new ObjectIntPair<>(), false); for (int i = 1; i <= 65536; ++i) { state.keyLength = i; state.ensureSpaceForKey(); state.keyBuffer[state.keyLength - 1] = (byte) ((i - 1) % 0xff); for (int j = 0; j < i - 1; ++j) { // Check that earlier bytes were preserved as the buffer grew. assertEquals((byte) (j % 0xff), state.keyBuffer[j]); } } }
@SuppressWarnings("unchecked") protected STATE createSeekerState() { // This will fail for non-default seeker state if the subclass does not // override this method. return (STATE) new SeekerState(); }
@SuppressWarnings("unchecked") protected STATE createSeekerState() { // This will fail for non-default seeker state if the subclass does not // override this method. return (STATE) new SeekerState(); }
@SuppressWarnings("unchecked") protected STATE createSeekerState() { // This will fail for non-default seeker state if the subclass does not // override this method. return (STATE) new SeekerState(this.tmpPair, this.includesTags()); }
@SuppressWarnings("unchecked") protected STATE createSeekerState() { // This will fail for non-default seeker state if the subclass does not // override this method. return (STATE) new SeekerState(this.tmpPair, this.includesTags()); }
@Test public void testEnsureSpaceForKey() { BufferedDataBlockEncoder.SeekerState state = new BufferedDataBlockEncoder.SeekerState( new ObjectIntPair<>(), false); for (int i = 1; i <= 65536; ++i) { state.keyLength = i; state.ensureSpaceForKey(); state.keyBuffer[state.keyLength - 1] = (byte) ((i - 1) % 0xff); for (int j = 0; j < i - 1; ++j) { // Check that earlier bytes were preserved as the buffer grew. assertEquals((byte) (j % 0xff), state.keyBuffer[j]); } } }
@SuppressWarnings("unchecked") protected STATE createSeekerState() { // This will fail for non-default seeker state if the subclass does not // override this method. return (STATE) new SeekerState(this.tmpPair, this.includesTags()); }