org.apache.hadoop.io.Text.append()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(187)

本文整理了Java中org.apache.hadoop.io.Text.append()方法的一些代码示例,展示了Text.append()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Text.append()方法的具体详情如下:
包路径:org.apache.hadoop.io.Text
类名称:Text
方法名:append

Text.append介绍

[英]Append a range of bytes to the end of the given text
[中]在给定文本的末尾追加一个字节范围

代码示例

代码示例来源:origin: apache/hive

case '\\':
 if (hadSlash) {
  text.append(textBytes, i, 1);
  hadSlash = false;
 if (hadSlash) {
  byte[] newLine = newLineUnescapeBytes;
  text.append(newLine, 0, newLine.length);
  text.append(textBytes, i, 1);
 if (hadSlash) {
  byte[] carriageReturn = carriageReturnUnescapeBytes;
  text.append(carriageReturn, 0, carriageReturn.length);
  text.append(textBytes, i, 1);
 if (hadSlash) {
  byte[] tab = tabUnescapeBytes;
  text.append(tab, 0, tab.length);
  text.append(textBytes, i, 1);
  text.append(textBytes, i-1, 1);
  hadSlash = false;
 text.append(ctrlA, 0, ctrlA.length);
 break;

代码示例来源:origin: apache/drill

case '\\':
 if (hadSlash) {
  text.append(textBytes, i, 1);
  hadSlash = false;
 if (hadSlash) {
  byte[] newLine = newLineUnescapeBytes;
  text.append(newLine, 0, newLine.length);
  text.append(textBytes, i, 1);
 if (hadSlash) {
  byte[] carriageReturn = carriageReturnUnescapeBytes;
  text.append(carriageReturn, 0, carriageReturn.length);
  text.append(textBytes, i, 1);
 if (hadSlash) {
  byte[] tab = tabUnescapeBytes;
  text.append(tab, 0, tab.length);
  text.append(textBytes, i, 1);
  text.append(textBytes, i-1, 1);
  hadSlash = false;
 text.append(ctrlA, 0, ctrlA.length);
 break;

代码示例来源:origin: apache/hive

escape.append(escaped, start, len);

代码示例来源:origin: apache/drill

escape.append(escaped, start, len);

代码示例来源:origin: org.apache.hadoop/hadoop-common

if (bufferLength <= 0) {
  if (ambiguousByteCount > 0) {
   str.append(recordDelimiterBytes, 0, ambiguousByteCount);
   bytesConsumed += ambiguousByteCount;
if (appendLength >= 0 && ambiguousByteCount > 0) {
 str.append(recordDelimiterBytes, 0, ambiguousByteCount);
 ambiguousByteCount = 0;
 str.append(buffer, startPosn, appendLength);
 txtLength += appendLength;

代码示例来源:origin: org.apache.hadoop/hadoop-common

str.append(buffer, startPosn, appendLength);
txtLength += appendLength;

代码示例来源:origin: apache/accumulo

private static Text nextRow(Text row) {
 Text next = new Text(row);
 next.append(byte0, 0, byte0.length);
 return next;
}

代码示例来源:origin: apache/accumulo

public static Text truncate(Text text, int maxLen) {
 if (text.getLength() > maxLen) {
  Text newText = new Text();
  newText.append(text.getBytes(), 0, maxLen);
  String suffix = "... TRUNCATED";
  newText.append(suffix.getBytes(UTF_8), 0, suffix.length());
  return newText;
 }
 return text;
}

代码示例来源:origin: apache/accumulo

@Override
protected Key buildKey(Text partition, Text term, Text docID) {
 Text colq = new Text(term);
 colq.append(nullByte, 0, 1);
 colq.append(docID.getBytes(), 0, docID.getLength());
 colq.append(nullByte, 0, 1);
 return new Key(partition, indexColf, colq);
}

代码示例来源:origin: apache/accumulo

public static Text getRow(Table.ID tableId, Text endRow) {
 Text entry = new Text(tableId.getUtf8());
 if (endRow == null) {
  // append delimiter for default tablet
  entry.append(new byte[] {'<'}, 0, 1);
 } else {
  // append delimiter for regular tablets
  entry.append(new byte[] {';'}, 0, 1);
  entry.append(endRow.getBytes(), 0, endRow.getLength());
 }
 return entry;
}

代码示例来源:origin: apache/accumulo

static Text decode(String s) {
  Text t = new Text();

  byte[] sb = s.getBytes(UTF_8);

  // very inefficient code
  for (int i = 0; i < sb.length; i++) {
   if (sb[i] != '%') {
    t.append(new byte[] {sb[i]}, 0, 1);
   } else {
    byte hex[] = {sb[++i], sb[++i]};
    String hs = new String(hex, UTF_8);
    int b = Integer.parseInt(hs, 16);
    t.append(new byte[] {(byte) b}, 0, 1);
   }
  }

  return t;
 }
}

代码示例来源:origin: intel-hadoop/HiBench

public Text nextUrlText() {
  Text result = new Text("http://");
  
  int ulen = nextUrlLength();
  byte[] url = new byte[ulen + 7];
  for (int i=0; i<ulen; i++) {
    url[i] = (byte) (randUrl.nextInt(26) + 'a');
  }
  result.append(url, 0, ulen);
  return result;
}

代码示例来源:origin: apache/accumulo

public TabletLocatorImpl(Table.ID tableId, TabletLocator parent, TabletLocationObtainer tlo,
  TabletServerLockChecker tslc) {
 this.tableId = tableId;
 this.parent = parent;
 this.locationObtainer = tlo;
 this.lockChecker = tslc;
 this.lastTabletRow = new Text(tableId.getUtf8());
 lastTabletRow.append(new byte[] {'<'}, 0, 1);
}

代码示例来源:origin: apache/accumulo

private static Text rowAfterPrevRow(KeyExtent nke) {
 Text row = new Text(nke.getPrevEndRow());
 row.append(new byte[] {0}, 0, 1);
 return row;
}

代码示例来源:origin: apache/accumulo

protected static Text getStartRowForExtent(KeyExtent extent) {
 Text start = extent.getPrevEndRow();
 if (start != null) {
  start = new Text(start);
  // ACCUMULO-3967 We want the first possible key in this tablet, not the following row from the
  // previous tablet
  start.append(byte0, 0, 1);
 }
 return start;
}

代码示例来源:origin: apache/accumulo

private static Text rowAfterPrevRow(KeyExtent nke) {
 Text row = new Text(nke.getPrevEndRow());
 row.append(new byte[] {0}, 0, 1);
 return row;
}

代码示例来源:origin: apache/accumulo

private static Text findInitialEnd(Scanner scanner) {
 Text end = new Text(new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff});
 scanner.setRange(new Range(end, null));
 while (scanner.iterator().hasNext()) {
  Text t = new Text();
  t.append(end.getBytes(), 0, end.getLength());
  t.append(end.getBytes(), 0, end.getLength());
  end = t;
  scanner.setRange(new Range(end, null));
 }
 return end;
}

代码示例来源:origin: apache/accumulo

protected Key buildDocKey() {
 if (log.isTraceEnabled())
  log.trace("building doc key for {} {}", currentPartition, currentDocID);
 int zeroIndex = currentDocID.find("\0");
 if (zeroIndex < 0)
  throw new IllegalArgumentException("bad current docID");
 Text colf = new Text(docColf);
 colf.append(nullByte, 0, 1);
 colf.append(currentDocID.getBytes(), 0, zeroIndex);
 docColfSet = Collections.singleton(new ArrayByteSequence(colf.getBytes(), 0, colf.getLength()));
 if (log.isTraceEnabled())
  log.trace("{} {}", zeroIndex, currentDocID.getLength());
 Text colq = new Text();
 colq.set(currentDocID.getBytes(), zeroIndex + 1, currentDocID.getLength() - zeroIndex - 1);
 Key k = new Key(currentPartition, colf, colq);
 if (log.isTraceEnabled())
  log.trace("built doc key for seek: {}", k);
 return k;
}

代码示例来源:origin: apache/accumulo

row.append(new byte[] {0}, 0, 1);

代码示例来源:origin: apache/accumulo

if (row != null && (endRow == null || row.compareTo(endRow) < 0)) {
 row = new Text(row);
 row.append(byte0, 0, byte0.length);
} else
 break;

相关文章