|
Secure iNet Factory | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jscape.util.ByteBuffer
public class ByteBuffer
Class for managing an array of bytes.
Constructor Summary | |
---|---|
ByteBuffer()
Creates a new instance of ByteBuffer |
|
ByteBuffer(byte[] buffer)
Creates a new instance of ByteBuffer |
|
ByteBuffer(int size)
Creates a new ByteBuffer object. |
Method Summary | |
---|---|
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.lang.String 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.lang.String encoding)
Checks if buffer ends with specified String |
boolean |
equals(java.lang.Object obj)
Checks for equality of this ByteBuffer . |
boolean |
equals(java.lang.String str,
java.lang.String 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 |
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.lang.String encoding)
Locates the index of the specified data. |
int |
indexOf(java.lang.String str,
java.lang.String 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.lang.String 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.lang.String encoding)
Gets buffer as a String using provided character encoding. |
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ByteBuffer()
public ByteBuffer(int size)
size
- int initial size of bufferpublic ByteBuffer(byte[] buffer)
buffer
- the data to initialize this ByteBuffer withMethod Detail |
---|
public void append(ByteBuffer buf)
buf
- the ByteBuffer
to appending frompublic void append(byte[] buf, int offset, int len)
ByteBuffer
buf
- a byte arrayoffset
- the beginning index of arraylen
- the total number of bytes to appending, starting from offsetpublic void append(byte[] buf)
ByteBuffer
buf
- a byte[]
public void append(byte b)
ByteBuffer
b
- a single byte
public void append(java.lang.String data, java.lang.String encoding) throws java.io.UnsupportedEncodingException
ByteBuffer
data
- the data to appendingencoding
- the character encoding to use
java.io.UnsupportedEncodingException
- if invalid encoding specifiedpublic void append(char[] data)
ByteBuffer
data
- 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.Object
String
public java.lang.String toString(java.lang.String encoding) throws java.io.UnsupportedEncodingException
String
using provided character encoding.
encoding
- the character encoding to use
java.io.UnsupportedEncodingException
- if encoding is not validpublic int length()
ByteBuffer
in bytes.
public ByteBuffer getBuffer(int start, int end)
start
- the beginning indexend
- the end index
public ByteBuffer getBuffer(int start)
start
- the beginning index
public int indexOf(byte data, int begin)
data
- the byte to search forbegin
- the beginning index to start searching from
public int indexOf(byte data)
data
- the byte[] to search for
public int indexOf(byte[] data, int begin)
data
- the byte[] to search forbegin
- the beginning index to start searching from
public int indexOf(byte[] data)
data
- the byte[] to search for
public int indexOf(java.lang.String str, java.lang.String encoding, int begin) throws java.io.UnsupportedEncodingException
str
- the String to search forencoding
- the character encoding to use when performing searchbegin
- begin the beginning index
java.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.lang.String encoding) throws java.io.UnsupportedEncodingException
str
- the String to search forencoding
- the character encoding to use when performing search
java.io.UnsupportedEncodingException
- if encoding is invalidpublic boolean startsWith(java.lang.String str, java.lang.String encoding) throws java.io.UnsupportedEncodingException
str
- the String to check forencoding
- the character encoding to use
true
if buffer starts with specified String, false
otherwise
java.io.UnsupportedEncodingException
- if encoding is invalidpublic boolean endsWith(java.lang.String str, java.lang.String encoding) throws java.io.UnsupportedEncodingException
str
- the String to check forencoding
- the character encoding to use
true
if data ends with specified String, false
otherwise
java.io.UnsupportedEncodingException
- if encoding is invalidpublic boolean equals(java.lang.String str, java.lang.String encoding) throws java.io.UnsupportedEncodingException
String
str
- the String
to check forencoding
- the character encoding to use
true
if data equals specified String, false
otherwise
java.io.UnsupportedEncodingException
- if encoding is invalidpublic boolean equals(java.lang.Object obj)
ByteBuffer
.
equals
in class java.lang.Object
obj
- a ByteBuffer
true
if equal, false
otherwise
|
Secure iNet Factory | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |