class ListOfBytesInputStream extends InputStream {

    @Override
    public synchronized int read()
    {
        int listPos = myPosition / myMaxChunkSize;
        int arrayPos = myPosition % myMaxChunkSize;
        int value = -1;
        if (myPosition < myCount)
        {
            value = myBuffer.get(listPos)[arrayPos] & 0xff;
            myPosition++;
        }
        return value;
    }

    public  ListOfBytesInputStream(List<byte[]> data, int length, int maxChunkSize);

}