Java 类org.apache.hadoop.mapred.LineRecordReader.LineReader 实例源码

项目:hadoop-EAR    文件:TestStreamedMerge.java   
@Override
public void run() {
  try {
    in_ = connectInputStream();
    LineReader lineReader = new LineReader((InputStream)in_, conf_);

    while (true) {
      byte[] b = UTF8ByteArrayUtils.readLine(lineReader);
      if (b == null) {
        break;
      }
      buf_.append(new String(b, "UTF-8"));
      buf_.append('\n');
    }
    lineReader.close();
    in_.close();
  } catch (IOException io) {
    throw new RuntimeException(io);
  }
}
项目:RDFS    文件:TestStreamedMerge.java   
@Override
public void run() {
  try {
    in_ = connectInputStream();
    LineReader lineReader = new LineReader((InputStream)in_, conf_);

    while (true) {
      byte[] b = UTF8ByteArrayUtils.readLine(lineReader);
      if (b == null) {
        break;
      }
      buf_.append(new String(b, "UTF-8"));
      buf_.append('\n');
    }
    lineReader.close();
    in_.close();
  } catch (IOException io) {
    throw new RuntimeException(io);
  }
}
项目:hadoop-EAR    文件:UTF8ByteArrayUtils.java   
/**
 * Read a utf8 encoded line from a data input stream. 
 * @param lineReader LineReader to read the line from.
 * @return a byte array containing the line 
 * @throws IOException
 */
public static byte [] readLine(LineReader lineReader) 
throws IOException {
  Text out = new Text();
  long bytes = lineReader.readLine(out);
  if (bytes <= 0)
    return null;
  return out.getBytes();
}
项目:RDFS    文件:UTF8ByteArrayUtils.java   
/**
 * Read a utf8 encoded line from a data input stream. 
 * @param lineReader LineReader to read the line from.
 * @return a byte array containing the line 
 * @throws IOException
 */
public static byte [] readLine(LineReader lineReader) 
throws IOException {
  Text out = new Text();
  long bytes = lineReader.readLine(out);
  if (bytes <= 0)
    return null;
  return out.getBytes();
}