Constructor and Description |
---|
BytesRefBuilder()
Sole constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
append(byte b)
Append a single byte to this builder.
|
void |
append(byte[] b,
int off,
int len)
Append the provided bytes to this builder.
|
void |
append(BytesRef ref)
Append the provided bytes to this builder.
|
void |
append(BytesRefBuilder builder)
Append the provided bytes to this builder.
|
byte |
byteAt(int offset)
Return the byte at the given offset.
|
byte[] |
bytes()
Return a reference to the bytes of this builder.
|
void |
clear()
Reset this builder to the empty state.
|
void |
copyBytes(byte[] b,
int off,
int len)
Replace the content of this builder with the provided bytes.
|
void |
copyBytes(BytesRef ref)
Replace the content of this builder with the provided bytes.
|
void |
copyBytes(BytesRefBuilder builder)
Replace the content of this builder with the provided bytes.
|
void |
copyChars(char[] text,
int off,
int len)
Replace the content of this buffer with UTF-8 encoded bytes that would
represent the provided text.
|
void |
copyChars(CharSequence text)
Replace the content of this buffer with UTF-8 encoded bytes that would
represent the provided text.
|
void |
copyChars(CharSequence text,
int off,
int len)
Replace the content of this buffer with UTF-8 encoded bytes that would
represent the provided text.
|
boolean |
equals(Object obj) |
BytesRef |
get()
Return a
BytesRef that points to the internal content of this
builder. |
void |
grow(int capacity)
Ensure that this builder can hold at least
capacity bytes
without resizing. |
int |
hashCode() |
int |
length()
Return the number of bytes in this buffer.
|
void |
setByteAt(int offset,
byte b)
Set a byte.
|
void |
setLength(int length)
Set the length.
|
BytesRef |
toBytesRef()
Build a new
BytesRef that has the same content as this buffer. |
public byte[] bytes()
public int length()
public void setLength(int length)
public byte byteAt(int offset)
public void setByteAt(int offset, byte b)
public void grow(int capacity)
capacity
bytes
without resizing.public void append(byte b)
public void append(byte[] b, int off, int len)
public void append(BytesRef ref)
public void append(BytesRefBuilder builder)
public void clear()
public void copyBytes(byte[] b, int off, int len)
clear()
and then append(byte[], int, int)
.public void copyBytes(BytesRef ref)
clear()
and then append(BytesRef)
.public void copyBytes(BytesRefBuilder builder)
clear()
and then append(BytesRefBuilder)
.public void copyChars(CharSequence text)
public void copyChars(CharSequence text, int off, int len)
public void copyChars(char[] text, int off, int len)
public BytesRef get()
BytesRef
that points to the internal content of this
builder. Any update to the content of this builder might invalidate
the provided ref
and vice-versa.public BytesRef toBytesRef()
BytesRef
that has the same content as this buffer.Copyright © 2000-2018 Apache Software Foundation. All Rights Reserved.