ConcatenatedValueSource extends Source { @Override protected byte[] getData(final BigInteger offset, final BigInteger length) { if (!isAvailable(offset, length)) { throw new IllegalStateException(format("Data to read is not available (offset=%d;length=%d;source=%s).", offset, length, this)); } return getData(values, ZERO, ZERO, offset, length, new byte[length.intValueExact()]).computeResult(); } private  ConcatenatedValueSource(final ImmutableList<Value> values, final BigInteger length); static Optional<ConcatenatedValueSource> create(final ImmutableList<Value> inputValues); @Override String toString(); @Override boolean equals(final Object obj); @Override int hashCode(); final ImmutableList<Value> values; final BigInteger length; }
@Test public void checkData() { byte[] data = cvs.getData(BigInteger.valueOf(offset), BigInteger.valueOf(length)); assertEquals(length, data.length); for (int i = 0; i < length; i++) { assertEquals(offset+i, data[i]); } }