Java Code Examples for org.apache.hadoop.io.IOUtils#wrappedReadForCompressedData()

The following examples show how to use org.apache.hadoop.io.IOUtils#wrappedReadForCompressedData() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IFile.java    From hadoop with Apache License 2.0 5 votes vote down vote up
/**
 * Read upto len bytes into buf starting at offset off.
 * 
 * @param buf buffer 
 * @param off offset
 * @param len length of buffer
 * @return the no. of bytes read
 * @throws IOException
 */
private int readData(byte[] buf, int off, int len) throws IOException {
  int bytesRead = 0;
  while (bytesRead < len) {
    int n = IOUtils.wrappedReadForCompressedData(in, buf, off + bytesRead,
        len - bytesRead);
    if (n < 0) {
      return bytesRead;
    }
    bytesRead += n;
  }
  return len;
}
 
Example 2
Source File: IFile.java    From big-c with Apache License 2.0 5 votes vote down vote up
/**
 * Read upto len bytes into buf starting at offset off.
 * 
 * @param buf buffer 
 * @param off offset
 * @param len length of buffer
 * @return the no. of bytes read
 * @throws IOException
 */
private int readData(byte[] buf, int off, int len) throws IOException {
  int bytesRead = 0;
  while (bytesRead < len) {
    int n = IOUtils.wrappedReadForCompressedData(in, buf, off + bytesRead,
        len - bytesRead);
    if (n < 0) {
      return bytesRead;
    }
    bytesRead += n;
  }
  return len;
}
 
Example 3
Source File: IFile.java    From incubator-tez with Apache License 2.0 5 votes vote down vote up
/**
 * Read upto len bytes into buf starting at offset off.
 *
 * @param buf buffer
 * @param off offset
 * @param len length of buffer
 * @return the no. of bytes read
 * @throws IOException
 */
private int readData(byte[] buf, int off, int len) throws IOException {
  int bytesRead = 0;
  while (bytesRead < len) {
    int n = IOUtils.wrappedReadForCompressedData(in, buf, off + bytesRead,
        len - bytesRead);
    if (n < 0) {
      return bytesRead;
    }
    bytesRead += n;
  }
  return len;
}
 
Example 4
Source File: IFile.java    From tez with Apache License 2.0 5 votes vote down vote up
/**
 * Read up to len bytes into buf starting at offset off.
 *
 * @param buf buffer
 * @param off offset
 * @param len length of buffer
 * @return the no. of bytes read
 * @throws IOException
 */
private int readData(byte[] buf, int off, int len) throws IOException {
  int bytesRead = 0;
  while (bytesRead < len) {
    int n = IOUtils.wrappedReadForCompressedData(in, buf, off + bytesRead,
        len - bytesRead);
    if (n < 0) {
      return bytesRead;
    }
    bytesRead += n;
  }
  return len;
}