Package org.apache.hadoop.io

Examples of org.apache.hadoop.io.Text.clear()


      Map<Object, Object> r;
      if (reuse == null) {
        r = new HashMap<Object, Object>();
      } else {
        r = (HashMap<Object, Object>) reuse;
        r.clear();
      }

      while (true) {
        int more = buffer.read(invert);
        if (more == 0) {
View Full Code Here


        // RCFile读出来是数组,单独处理
        key = new LongWritable();
        BytesRefArrayWritable value = new BytesRefArrayWritable();
        while (reader.next(key, value) && count < MAX_RECORD_TO_READ) {
          StringBuffer sb = new StringBuffer();
          textValue.clear();
          for (int i = 0; i < value.size(); i++) {
            BytesRefWritable v = value.get(i);
            textValue.set(v.getData(), v.getStart(), v.getLength());
            sb.append(textValue.toString());
            if (i < value.size() - 1) {
View Full Code Here

        // so the buffer will be null, in that case just return result
        // as it will default to empty
        if (dictionaryBuffer != null) {
          dictionaryBuffer.setText(result, offset, length);
        } else {
          result.clear();
        }
      }
      return result;
    }
View Full Code Here

  public static Text escapeText(Text text) {
    int length = text.getLength();
    byte[] textBytes = text.getBytes();

    Text escape = new Text(text);
    escape.clear();

    for (int i = 0; i < length; ++i) {
      int c = text.charAt(i);
      byte[] escaped;
      int start;
View Full Code Here

        // RCFile读出来是数组,单独处理
        key = new LongWritable();
        BytesRefArrayWritable value = new BytesRefArrayWritable();
        while (reader.next(key, value) && count < MAX_RECORD_TO_READ) {
          textValue.clear();
          for (int i = 0; i < value.size(); i++) {
            BytesRefWritable v = value.get(i);
            textValue.set(v.getData(), v.getStart(), v.getLength());
            w.write(csvEncode(textValue.toString()));
            if (i < value.size() - 1) {
View Full Code Here

        LineReader lineReader = new LineReader((InputStream)in_, conf_);
        Text line = new Text();
        while (lineReader.readLine(line) > 0) {
          buf_.append(line.toString());
          buf_.append('\n');
          line.clear();
        }
        lineReader.close();
        in_.close();
      } catch (IOException io) {
        throw new RuntimeException(io);
View Full Code Here

        // 3/4 Tool to Hadoop
        while (lineReader.readLine(line) > 0) {
          answer = line.getBytes();
          splitKeyVal(answer, line.getLength(), key, val);
          output.collect(key, val);
          line.clear();
          numRecWritten_++;
          long now = System.currentTimeMillis();
          if (now-lastStdoutReport > reporterOutDelay_) {
            lastStdoutReport = now;
            String hline = "Records R/W=" + numRecRead_ + "/" + numRecWritten_;
View Full Code Here

          long now = System.currentTimeMillis();
          if (reporter != null && now-lastStderrReport > reporterErrDelay_) {
            lastStderrReport = now;
            reporter.progress();
          }
          line.clear();
        }
        if (lineReader != null) {
          lineReader.close();
        }
        if (clientErr_ != null) {
View Full Code Here

      if (startHash <= hashCode && hashCode <= endHash) {
        stores.add(new Store(Long.parseLong(readStr[2]),
            Long.parseLong(readStr[3]), startHash,
            endHash));
      }
      line.clear();
    }
    try {
      lin.close();
    } catch(IOException io){
      // do nothing just a read.
View Full Code Here

        if (harPath.compareTo(new Path(parsed[0])) == 0) {
          // bingo!
          retStr = lineFeed;
          break;
        }
        line.clear();
      }
      if (retStr != null)
        break;
    }
    try {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.