code: private static int read(DocFile inFile, InputStream input, byte[] buf) throws DocFileIOException {
          try {
              return input.read(buf);
          } catch (IOException e) {
              throw new DocFileIOException(inFile, DocFileIOException.Mode.READ, e);
          }
      }
docs: Reads from an input stream opened from a given file into a given buffer.
  If an IOException occurs, it is wrapped in a DocFileIOException.
  
  @param inFile the file for the stream
  @param input the stream
  @param buf the buffer
  @return the number of bytes read, or -1 if at end of file
  @throws DocFileIOException if an exception occurred while reading the stream