code: protected long readFromByteArray(OutputStream stream, long length, long position) throws IOException
     {
        byte[] data = getAsByteArray();
        length = validateAndAdjustLenght(length, position, data.length);
  
        stream.write(data, (int)position, (int)length);
  
        return length;
     }
docs: Reads data from array of bytes to {@link OutputStream}.