ByteString (original) (raw)
Modifier and Type
Method and Description
abstract java.nio.ByteBuffer
[asReadOnlyByteBuffer](../../../com/google/protobuf/ByteString.html#asReadOnlyByteBuffer--)()
Constructs a read-only java.nio.ByteBuffer
whose content is equal to the contents of this byte string.
abstract java.util.List<java.nio.ByteBuffer>
[asReadOnlyByteBufferList](../../../com/google/protobuf/ByteString.html#asReadOnlyByteBufferList--)()
Constructs a list of read-only java.nio.ByteBuffer
objects such that the concatenation of their contents is equal to the contents of this byte string.
abstract byte
[byteAt](../../../com/google/protobuf/ByteString.html#byteAt-int-)(int index)
Gets the byte at the given index.
[ByteString](../../../com/google/protobuf/ByteString.html "class in com.google.protobuf")
[concat](../../../com/google/protobuf/ByteString.html#concat-com.google.protobuf.ByteString-)([ByteString](../../../com/google/protobuf/ByteString.html "class in com.google.protobuf") other)
Concatenate the given ByteString
to this one.
static [ByteString](../../../com/google/protobuf/ByteString.html "class in com.google.protobuf")
[copyFrom](../../../com/google/protobuf/ByteString.html#copyFrom-byte:A-)(byte[] bytes)
Copies the given bytes into a ByteString
.
static [ByteString](../../../com/google/protobuf/ByteString.html "class in com.google.protobuf")
[copyFrom](../../../com/google/protobuf/ByteString.html#copyFrom-byte:A-int-int-)(byte[] bytes, int offset, int size)
Copies the given bytes into a ByteString
.
static [ByteString](../../../com/google/protobuf/ByteString.html "class in com.google.protobuf")
[copyFrom](../../../com/google/protobuf/ByteString.html#copyFrom-java.nio.ByteBuffer-)(java.nio.ByteBuffer bytes)
Copies the remaining bytes from a java.nio.ByteBuffer
into a ByteString
.
static [ByteString](../../../com/google/protobuf/ByteString.html "class in com.google.protobuf")
[copyFrom](../../../com/google/protobuf/ByteString.html#copyFrom-java.nio.ByteBuffer-int-)(java.nio.ByteBuffer bytes, int size)
Copies the next size
bytes from a java.nio.ByteBuffer
into a ByteString
.
static [ByteString](../../../com/google/protobuf/ByteString.html "class in com.google.protobuf")
[copyFrom](../../../com/google/protobuf/ByteString.html#copyFrom-java.lang.Iterable-)(java.lang.Iterable<[ByteString](../../../com/google/protobuf/ByteString.html "class in com.google.protobuf")> byteStrings)
Concatenates all byte strings in the iterable and returns the result.
static [ByteString](../../../com/google/protobuf/ByteString.html "class in com.google.protobuf")
[copyFrom](../../../com/google/protobuf/ByteString.html#copyFrom-java.lang.String-java.nio.charset.Charset-)(java.lang.String text, java.nio.charset.Charset charset)
Encodes text
into a sequence of bytes using the named charset and returns the result as a ByteString
.
static [ByteString](../../../com/google/protobuf/ByteString.html "class in com.google.protobuf")
[copyFrom](../../../com/google/protobuf/ByteString.html#copyFrom-java.lang.String-java.lang.String-)(java.lang.String text, java.lang.String charsetName)
Encodes text
into a sequence of bytes using the named charset and returns the result as a ByteString
.
static [ByteString](../../../com/google/protobuf/ByteString.html "class in com.google.protobuf")
[copyFromUtf8](../../../com/google/protobuf/ByteString.html#copyFromUtf8-java.lang.String-)(java.lang.String text)
Encodes text
into a sequence of UTF-8 bytes and returns the result as a ByteString
.
void
[copyTo](../../../com/google/protobuf/ByteString.html#copyTo-byte:A-int-)(byte[] target, int offset)
Copies bytes into a buffer at the given offset.
void
[copyTo](../../../com/google/protobuf/ByteString.html#copyTo-byte:A-int-int-int-)(byte[] target, int sourceOffset, int targetOffset, int numberToCopy)
abstract void
[copyTo](../../../com/google/protobuf/ByteString.html#copyTo-java.nio.ByteBuffer-)(java.nio.ByteBuffer target)
Copies bytes into a ByteBuffer.
boolean
[endsWith](../../../com/google/protobuf/ByteString.html#endsWith-com.google.protobuf.ByteString-)([ByteString](../../../com/google/protobuf/ByteString.html "class in com.google.protobuf") suffix)
Tests if this bytestring ends with the specified suffix.
abstract boolean
[equals](../../../com/google/protobuf/ByteString.html#equals-java.lang.Object-)(java.lang.Object o)
int
[hashCode](../../../com/google/protobuf/ByteString.html#hashCode--)()
Compute the hashCode using the traditional algorithm from ByteString.
boolean
[isEmpty](../../../com/google/protobuf/ByteString.html#isEmpty--)()
Returns true
if the size is 0
, false
otherwise.
abstract boolean
[isValidUtf8](../../../com/google/protobuf/ByteString.html#isValidUtf8--)()
Tells whether this ByteString
represents a well-formed UTF-8 byte sequence, such that the original bytes can be converted to a String object and then round tripped back to bytes without loss.
[ByteString.ByteIterator](../../../com/google/protobuf/ByteString.ByteIterator.html "interface in com.google.protobuf")
[iterator](../../../com/google/protobuf/ByteString.html#iterator--)()
abstract [CodedInputStream](../../../com/google/protobuf/CodedInputStream.html "class in com.google.protobuf")
[newCodedInput](../../../com/google/protobuf/ByteString.html#newCodedInput--)()
abstract java.io.InputStream
[newInput](../../../com/google/protobuf/ByteString.html#newInput--)()
Creates an InputStream
which can be used to read the bytes.
static [ByteString.Output](../../../com/google/protobuf/ByteString.Output.html "class in com.google.protobuf")
[newOutput](../../../com/google/protobuf/ByteString.html#newOutput--)()
static [ByteString.Output](../../../com/google/protobuf/ByteString.Output.html "class in com.google.protobuf")
[newOutput](../../../com/google/protobuf/ByteString.html#newOutput-int-)(int initialCapacity)
static [ByteString](../../../com/google/protobuf/ByteString.html "class in com.google.protobuf")
[readFrom](../../../com/google/protobuf/ByteString.html#readFrom-java.io.InputStream-)(java.io.InputStream streamToDrain)
Completely reads the given stream's bytes into a ByteString
, blocking if necessary until all bytes are read through to the end of the stream.
static [ByteString](../../../com/google/protobuf/ByteString.html "class in com.google.protobuf")
[readFrom](../../../com/google/protobuf/ByteString.html#readFrom-java.io.InputStream-int-)(java.io.InputStream streamToDrain, int chunkSize)
Completely reads the given stream's bytes into a ByteString
, blocking if necessary until all bytes are read through to the end of the stream.
static [ByteString](../../../com/google/protobuf/ByteString.html "class in com.google.protobuf")
[readFrom](../../../com/google/protobuf/ByteString.html#readFrom-java.io.InputStream-int-int-)(java.io.InputStream streamToDrain, int minChunkSize, int maxChunkSize)
abstract int
[size](../../../com/google/protobuf/ByteString.html#size--)()
Gets the number of bytes.
boolean
[startsWith](../../../com/google/protobuf/ByteString.html#startsWith-com.google.protobuf.ByteString-)([ByteString](../../../com/google/protobuf/ByteString.html "class in com.google.protobuf") prefix)
Tests if this bytestring starts with the specified prefix.
[ByteString](../../../com/google/protobuf/ByteString.html "class in com.google.protobuf")
[substring](../../../com/google/protobuf/ByteString.html#substring-int-)(int beginIndex)
Return the substring from beginIndex
, inclusive, to the end of the string.
abstract [ByteString](../../../com/google/protobuf/ByteString.html "class in com.google.protobuf")
[substring](../../../com/google/protobuf/ByteString.html#substring-int-int-)(int beginIndex, int endIndex)
Return the substring from beginIndex
, inclusive, to endIndex
, exclusive.
byte[]
[toByteArray](../../../com/google/protobuf/ByteString.html#toByteArray--)()
Copies bytes to a byte[]
.
java.lang.String
[toString](../../../com/google/protobuf/ByteString.html#toString--)()
java.lang.String
[toString](../../../com/google/protobuf/ByteString.html#toString-java.nio.charset.Charset-)(java.nio.charset.Charset charset)
Constructs a new String
by decoding the bytes using the specified charset.
java.lang.String
[toString](../../../com/google/protobuf/ByteString.html#toString-java.lang.String-)(java.lang.String charsetName)
Constructs a new String
by decoding the bytes using the specified charset.
java.lang.String
[toStringUtf8](../../../com/google/protobuf/ByteString.html#toStringUtf8--)()
Constructs a new String
by decoding the bytes as UTF-8.
static java.util.Comparator<[ByteString](../../../com/google/protobuf/ByteString.html "class in com.google.protobuf")>
[unsignedLexicographicalComparator](../../../com/google/protobuf/ByteString.html#unsignedLexicographicalComparator--)()
Returns a Comparator
which compares ByteString-s lexicographically as sequences of unsigned bytes (i.e.
abstract void
[writeTo](../../../com/google/protobuf/ByteString.html#writeTo-java.io.OutputStream-)(java.io.OutputStream out)
Writes a copy of the contents of this byte string to the specified output stream argument.