@Test public void shouldDataBeAccessible() throws IOException { final ByteBufferStorage storage = new ByteBufferStorage(10) { @Override protected void append(final ByteBuffer buffer) throws IOException { } @Override public Iterable<Pair<Long, int[]>> all() throws IOException { return new LinkedList<Pair<Long, int[]>>(); } }; storage.append(System.currentTimeMillis(), new int[0]); }
@Override public final void append(final long timestamp, final int[] consolidates) throws IOException { final int capacity = bits2Bytes(Long.SIZE) + bits2Bytes(Integer.SIZE) * consolidates.length; final ByteBuffer buffer = createByteBuffer(capacity); put(timestamp, buffer); put(consolidates, buffer); append(buffer); }
ByteBufferStorage extends Storage { @Override public final void append(final long timestamp, final int[] consolidates) throws IOException { final int capacity = bits2Bytes(Long.SIZE) + bits2Bytes(Integer.SIZE) * consolidates.length; final ByteBuffer buffer = createByteBuffer(capacity); put(timestamp, buffer); put(consolidates, buffer); append(buffer); } }
ByteBufferStorage extends Storage { @Override public final void append(final long timestamp, final int[] consolidates) throws IOException { final int capacity = bits2Bytes(Long.SIZE) + bits2Bytes(Integer.SIZE) * consolidates.length; final ByteBuffer buffer = createByteBuffer(capacity); put(timestamp, buffer); put(consolidates, buffer); append(buffer); } ByteBufferStorage(final int maximumSize); }
ByteBufferStorage extends Storage { @Override public final void append(final long timestamp, final int[] consolidates) throws IOException { final int capacity = bits2Bytes(Long.SIZE) + bits2Bytes(Integer.SIZE) * consolidates.length; final ByteBuffer buffer = createByteBuffer(capacity); put(timestamp, buffer); put(consolidates, buffer); append(buffer); } ByteBufferStorage(final int maximumSize); @Override final void append(final long timestamp, final int[] consolidates); }
ByteBufferStorage extends Storage { @Override public final void append(final long timestamp, final int[] consolidates) throws IOException { final int capacity = bits2Bytes(Long.SIZE) + bits2Bytes(Integer.SIZE) * consolidates.length; final ByteBuffer buffer = createByteBuffer(capacity); put(timestamp, buffer); put(consolidates, buffer); append(buffer); } ByteBufferStorage(final int maximumSize); @Override final void append(final long timestamp, final int[] consolidates);  }