public final class ByteString extends Object implements Comparable<ByteString>, Serializable
Option values and in an OptionMap.| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(ByteString o)
Compare this ByteString to another.
|
static ByteString |
copyOf(byte[] b,
int offs,
int len)
Create a byte string from the given array segment.
|
boolean |
equals(ByteString other)
Determine if this ByteString equals another ByteString.
|
boolean |
equals(Object obj)
Determine if this ByteString equals another ByteString.
|
byte[] |
getBytes()
Get a copy of the bytes of this ByteString.
|
void |
getBytes(byte[] dest)
Copy the bytes of this ByteString into the destination array.
|
void |
getBytes(byte[] dest,
int offs)
Copy the bytes of this ByteString into the destination array.
|
void |
getBytes(byte[] dest,
int offs,
int len)
Copy the bytes of this ByteString into the destination array.
|
static ByteString |
getBytes(ByteBuffer buffer)
Get a byte string from all remaining bytes of a ByteBuffer.
|
static ByteString |
getBytes(ByteBuffer buffer,
int length)
Get a byte string from a ByteBuffer.
|
static ByteString |
getBytes(String str,
Charset charset)
Get a byte string from the bytes of a character string.
|
static ByteString |
getBytes(String str,
String charset)
Get a byte string from the bytes of a character string.
|
int |
hashCode()
Get the hash code for this ByteString.
|
int |
length()
Get the number of bytes in this byte string.
|
static ByteString |
of(byte... bytes)
Create a byte string of the given literal bytes.
|
ByteString |
substring(int offs)
Get the substring of this string starting at the given offset.
|
ByteString |
substring(int offs,
int len)
Get the substring of this string starting at the given offset.
|
String |
toString(String charset)
Convert this byte string to a standard string.
|
public static ByteString of(byte... bytes)
bytes - the bytespublic static ByteString copyOf(byte[] b, int offs, int len)
b - the byte arrayoffs - the offset into the arraylen - the number of bytes to copypublic static ByteString getBytes(String str, String charset) throws UnsupportedEncodingException
str - the character stringcharset - the character set to useUnsupportedEncodingException - if the encoding is not supportedpublic static ByteString getBytes(String str, Charset charset)
str - the character stringcharset - the character set to usepublic static ByteString getBytes(ByteBuffer buffer)
buffer - the bufferpublic static ByteString getBytes(ByteBuffer buffer, int length)
buffer - the bufferlength - the number of bytes to getpublic byte[] getBytes()
public void getBytes(byte[] dest)
dest - the destination arraypublic void getBytes(byte[] dest,
int offs)
dest - the destination arrayoffs - the offset into the destination arraypublic void getBytes(byte[] dest,
int offs,
int len)
dest - the destination arrayoffs - the offset into the destination arraylen - the maximum number of bytes to copypublic String toString(String charset) throws UnsupportedEncodingException
charset - the character set to useUnsupportedEncodingException - if the charset is unknownpublic int length()
public ByteString substring(int offs)
offs - the offsetpublic ByteString substring(int offs, int len)
offs - the offsetlen - the substring lengthpublic int compareTo(ByteString o)
compareTo in interface Comparable<ByteString>o - the other ByteStringpublic int hashCode()
public boolean equals(Object obj)
public boolean equals(ByteString other)
other - the other objecttrue if they are equalCopyright © 2018 JBoss by Red Hat. All rights reserved.