code: protected long readFromFile(OutputStream stream, File file, long length, long position) throws IOException
     {
        FileInputStream in = null;
  
        try
        {
           if (channel == null || !channel.isOpen())
           {
              in = PrivilegedFileHelper.fileInputStream(file);
              channel = in.getChannel();
           }
  
           length = validateAndAdjustLenght(length, position, channel.size());
  
           MappedByteBuffer bb = channel.map(FileChannel.MapMode.READ_ONLY, position, length);
  
           WritableByteChannel ch = Channels.newChannel(stream);
           ch.write(bb);
           ch.close();
  
           return length;
        }
        finally
        {
           if (in != null)
           {
              in.close();
              if (channel != null)
              {
                 channel.close();
              }
           }
        }
     }
docs: Read <code>length</code> bytes from the binary value at <code>position</code> to the
  <code>stream</code>.