public class ByteBuffer
extends java.lang.Object
| Constructor and Description |
|---|
ByteBuffer()
Creates a new instance of ByteBuffer
|
ByteBuffer(byte[] buffer)
Creates a new instance of ByteBuffer
|
ByteBuffer(int size)
Creates a new ByteBuffer object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
append(byte b)
Appends data to this
ByteBuffer |
void |
append(byte[] buf)
Appends data to this
ByteBuffer |
void |
append(byte[] buf,
int offset,
int len)
Appends data to this
ByteBuffer |
void |
append(ByteBuffer buf)
Appends data to this ByteBuffer
|
void |
append(char c)
Appends a character to this ByteBuffer.
|
void |
append(char[] data)
Appends data to this
ByteBuffer |
void |
append(java.lang.String data,
java.nio.charset.Charset encoding)
Appends data to this
ByteBuffer |
boolean |
contains(byte[] data)
Checks if data is contained in this buffer.
|
boolean |
contains(byte[] data,
boolean matchAll)
Checks if data is contained in this buffer.
|
boolean |
endsWith(java.lang.String str,
java.nio.charset.Charset encoding)
Checks if buffer ends with specified String
|
boolean |
equals(java.lang.Object o) |
boolean |
equals(java.lang.String str,
java.nio.charset.Charset encoding)
Checks if buffer equals specified
String |
ByteBuffer |
getBuffer(int start)
Gets a portion of this ByteBuffer data.
|
ByteBuffer |
getBuffer(int start,
int end)
Gets a portion of this ByteBuffer data.
|
int |
hashCode() |
int |
indexOf(byte data)
Locates the index of the specified data.
|
int |
indexOf(byte[] data)
Locates the index of the specified data.
|
int |
indexOf(byte[] data,
int begin)
Locates the index of the specified data.
|
int |
indexOf(byte data,
int begin)
Locates the index of the specified data.
|
int |
indexOf(java.lang.String str,
java.nio.charset.Charset encoding)
Locates the index of the specified data.
|
int |
indexOf(java.lang.String str,
java.nio.charset.Charset encoding,
int begin)
Locates the index of the specified data.
|
int |
length()
Gets the length of this
ByteBuffer in bytes. |
boolean |
startsWith(java.lang.String str,
java.nio.charset.Charset encoding)
Checks if buffer starts with specified String
|
byte[] |
toByteArray()
Gets buffer as a byte array.
|
java.lang.String |
toString()
Gets buffer as a
String using system default character
encoding. |
java.lang.String |
toString(java.nio.charset.Charset encoding)
Gets buffer as a
String using provided character encoding. |
public ByteBuffer()
public ByteBuffer(int size)
size - int initial size of bufferpublic ByteBuffer(byte[] buffer)
buffer - the data to initialize this ByteBuffer withpublic void append(ByteBuffer buf)
buf - the ByteBuffer to appending frompublic void append(byte[] buf,
int offset,
int len)
ByteBufferbuf - a byte arrayoffset - the beginning index of arraylen - the total number of bytes to appending, starting from offsetpublic void append(byte[] buf)
ByteBufferbuf - a byte[]public void append(byte b)
ByteBufferb - a single bytepublic void append(java.lang.String data,
java.nio.charset.Charset encoding)
ByteBufferdata - the data to appendingencoding - the character encoding to usepublic void append(char[] data)
ByteBufferdata - the data to appendingpublic void append(char c)
c - the character to appendingpublic byte[] toByteArray()
byte[]public java.lang.String toString()
String using system default character
encoding.toString in class java.lang.ObjectStringpublic java.lang.String toString(java.nio.charset.Charset encoding)
String using provided character encoding.encoding - the character encoding to usepublic int length()
ByteBuffer in bytes.public ByteBuffer getBuffer(int start, int end)
start - the beginning indexend - the end indexpublic ByteBuffer getBuffer(int start)
start - the beginning indexpublic int indexOf(byte data,
int begin)
data - the byte to search forbegin - the beginning index to start searching frompublic int indexOf(byte data)
data - the byte[] to search forpublic int indexOf(byte[] data,
int begin)
data - the byte[] to search forbegin - the beginning index to start searching frompublic int indexOf(byte[] data)
data - the byte[] to search forpublic int indexOf(java.lang.String str,
java.nio.charset.Charset encoding,
int begin)
throws java.io.UnsupportedEncodingException
str - the String to search forencoding - the character encoding to use when performing searchbegin - begin the beginning indexjava.io.UnsupportedEncodingException - if encoding is invalidpublic boolean contains(byte[] data,
boolean matchAll)
data - the data to check formatchAll - if true then all data must be found in sequence, if false then only one byte of data
must be found.public boolean contains(byte[] data)
data - the data to check forpublic int indexOf(java.lang.String str,
java.nio.charset.Charset encoding)
throws java.io.UnsupportedEncodingException
str - the String to search forencoding - the character encoding to use when performing searchjava.io.UnsupportedEncodingException - if encoding is invalidpublic boolean startsWith(java.lang.String str,
java.nio.charset.Charset encoding)
throws java.io.UnsupportedEncodingException
str - the String to check forencoding - the character encoding to usetrue if buffer starts with specified String, false otherwisejava.io.UnsupportedEncodingException - if encoding is invalidpublic boolean endsWith(java.lang.String str,
java.nio.charset.Charset encoding)
throws java.io.UnsupportedEncodingException
str - the String to check forencoding - the character encoding to usetrue if data ends with specified String, false otherwisejava.io.UnsupportedEncodingException - if encoding is invalidpublic boolean equals(java.lang.String str,
java.nio.charset.Charset encoding)
throws java.io.UnsupportedEncodingException
Stringstr - the String to check forencoding - the character encoding to usetrue if data equals specified String, false otherwisejava.io.UnsupportedEncodingException - if encoding is invalidpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.ObjectCopyright © JSCAPE LLC. 1999-2021. All Rights Reserved