/** * Replace the content of this builder with the provided bytes. Equivalent to * calling {@link #clear()} and then {@link #append(BytesRef)}. */ public void copyBytes(BytesRef ref) { clear(); append(ref); }
/** * Replace the content of this builder with the provided bytes. Equivalent to * calling {@link #clear()} and then {@link #append(BytesRefBuilder)}. */ public void copyBytes(BytesRefBuilder builder) { clear(); append(builder); }
/** * Replace the content of this builder with the provided bytes. Equivalent to * calling {@link #clear()} and then {@link #append(byte[], int, int)}. */ public void copyBytes(byte[] b, int off, int len) { clear(); append(b, off, len); }
@Override public void clear() { bytes.clear(); }
output.clear(); return output.get(); } else {
term.clear(); validIndexPrefix = 0; currentFrame.rewind();
private void set(int i, Object o) { if (o == null) { values[i].clear(); } else { CollectionUtils.ensureNoSelfReferences(o); values[i].copyChars(o.toString()); } }
static void encodeFlags(BytesRefBuilder b, char flags[]) { int len = flags.length << 1; b.grow(len); b.clear(); for (int i = 0; i < flags.length; i++) { int flag = flags[i]; b.append((byte) ((flag >> 8) & 0xff)); b.append((byte) (flag & 0xff)); } }
currentFrame.loadBlock(); validIndexPrefix = 0; term.clear();
public static BytesRef join(BytesRef separator, BytesRefBuilder result, BytesRef... toJoin) { result.clear(); for (int i = 0; i < toJoin.length - 1; i++) { result.append(toJoin[i]); result.append(separator); } result.append(toJoin[toJoin.length-1]); return result.get(); }
previous.clear(); previous.copyChars(termAtt); BytesRef bytes = previous.get();
@Override public void collect(int doc, long bucket) throws IOException { assert bucket == 0; if (values.advanceExact(doc)) { final int valuesCount = values.docValueCount(); // SortedBinaryDocValues don't guarantee uniqueness so we // need to take care of dups previous.clear(); for (int i = 0; i < valuesCount; ++i) { final BytesRef bytes = values.nextValue(); if (includeExclude != null && !includeExclude.accept(bytes)) { continue; } if (i > 0 && previous.get().equals(bytes)) { continue; } long bucketOrdinal = bucketOrds.add(bytes); if (bucketOrdinal < 0) { // already seen bucketOrdinal = -1 - bucketOrdinal; collectExistingBucket(sub, doc, bucketOrdinal); } else { collectBucket(sub, doc, bucketOrdinal); } previous.copyBytes(bytes); } } } };
/** * Replace the content of this builder with the provided bytes. Equivalent to * calling {@link #clear()} and then {@link #append(byte[], int, int)}. */ public void copyBytes(byte[] b, int off, int len) { clear(); append(b, off, len); }
/** * Replace the content of this builder with the provided bytes. Equivalent to * calling {@link #clear()} and then {@link #append(BytesRef)}. */ public void copyBytes(BytesRef ref) { clear(); append(ref); }
/** * Replace the content of this builder with the provided bytes. Equivalent to * calling {@link #clear()} and then {@link #append(BytesRefBuilder)}. */ public void copyBytes(BytesRefBuilder builder) { clear(); append(builder); }
/** returns the bytes representation of the string val - TODO: should this return the indexed raw bytes not? */ public boolean bytesVal(int doc, BytesRefBuilder target) throws IOException { String s = strVal(doc); if (s==null) { target.clear(); return false; } target.copyChars(s); return true; }
/** returns the bytes representation of the string val - TODO: should this return the indexed raw bytes not? */ public boolean bytesVal(int doc, BytesRefBuilder target) { String s = strVal(doc); if (s==null) { target.clear(); return false; } target.copyChars(s); return true; }
@Override public BytesRef getBytesRef() { assert valueSize == 64 || valueSize == 32; if (shift >= valueSize) { bytes.clear(); } else if (valueSize == 64) { NumericUtils.longToPrefixCoded(value, shift, bytes); } else { NumericUtils.intToPrefixCoded((int) value, shift, bytes); } return bytes.get(); }
@Override public void fillValue(int doc) throws IOException { int ord = getOrdForDoc(doc); mval.value.clear(); mval.exists = ord >= 0; if (mval.exists) { mval.value.copyBytes(termsIndex.lookupOrd(ord)); } } };
public static BytesRef join(BytesRef separator, BytesRefBuilder result, BytesRef... toJoin) { result.clear(); for (int i = 0; i < toJoin.length - 1; i++) { result.append(toJoin[i]); result.append(separator); } result.append(toJoin[toJoin.length-1]); return result.get(); }