class ByteArrayReader extends Reader {

    @Override
    public int read(char[] cbuf, int off, int len) throws IOException {
        ensureOpen();
        if (position >= limit) {
            return -1;
        }
        int bytesRead = buffer.read(position, cbuf, off, len);
        position += bytesRead;
        return bytesRead;
    }

    public  ByteArrayReader(ByteArray buffer);

}