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

The following examples show how to use org.apache.hadoop.io.IOUtils#wrappedReadForCompressedData() . These examples are extracted from open source projects. 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 Project: hadoop   File: IFile.java    License: 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 Project: big-c   File: IFile.java    License: 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 Project: incubator-tez   File: IFile.java    License: 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 Project: tez   File: IFile.java    License: 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;
}