public class RawPacket extends Object implements WebSocketPacket
| Constructor and Description |
|---|
RawPacket(byte[] aByteArray)
Instantiates a new data packet and initializes its value to the passed
array of bytes.
|
RawPacket(int aInitialSize) |
RawPacket(String aString)
Instantiates a new data packet and initializes its value to the passed
string using the default encoding.
|
RawPacket(String aString,
String aEncoding)
Instantiates a new data packet and initializes its value to the passed
string using the passed encoding (should always be "UTF-8").
|
RawPacket(WebSocketFrameType aFrameType,
byte[] aByteArray)
Instantiates a new data packet and initializes its value to the passed
array of bytes.
|
RawPacket(WebSocketFrameType aFrameType,
String aString)
Instantiates a new data packet and initializes its value to the passed
string using the default encoding.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getASCII()
Interprets the data packet as a US-ASCII string and returns the string
in US-ASCII encoding.
|
byte[] |
getByteArray()
Returns the content of the data packet as an array of bytes.
|
Date |
getCreationDate() |
WebSocketFrameType |
getFrameType() |
String |
getString()
Returns the content of the data packet as a string using default
encoding.
|
String |
getString(String aEncoding)
Returns the content of the data packet as a string using the passed
encoding.
|
String |
getUTF8()
Interprets the data packet as a UTF8 string and returns the string
in UTF-8 encoding.
|
void |
initFragmented(int aTotal) |
boolean |
isComplete() |
boolean |
isFragmented() |
boolean |
isTimedOut() |
void |
packFragments() |
void |
setASCII(String aString)
Sets the value of the data packet to the given string by using
7 bit US-ASCII encoding.
|
void |
setByteArray(byte[] aByteArray)
Sets the value of the data packet to the given array of bytes.
|
void |
setCreationDate(Date aDate) |
void |
setFragment(String aString,
int aIdx) |
void |
setFrameType(WebSocketFrameType aFrameType) |
void |
setString(String aString)
Sets the value of the data packet to the given string by using
default encoding.
|
void |
setString(String aString,
String aEncoding)
Sets the value of the data packet to the given string by using
the passed encoding.
|
void |
setTimeout(long aMilliseconds) |
void |
setUTF8(String aString)
Sets the value of the data packet to the given string by using
UTF-8 encoding.
|
public RawPacket(int aInitialSize)
public RawPacket(byte[] aByteArray)
aByteArray - byte array to be used as value for the data packet.public RawPacket(WebSocketFrameType aFrameType, byte[] aByteArray)
aByteArray - byte array to be used as value for the data packet.public RawPacket(String aString)
aString - string to be used as value for the data packet.public RawPacket(WebSocketFrameType aFrameType, String aString)
aString - string to be used as value for the data packet.public RawPacket(String aString, String aEncoding) throws UnsupportedEncodingException
aString - string to be used as value for the data packet.aEncoding - should always be "UTF-8"UnsupportedEncodingExceptionpublic final void setByteArray(byte[] aByteArray)
WebSocketPacketsetByteArray in interface WebSocketPacketpublic final void setString(String aString)
WebSocketPacketsetString in interface WebSocketPacketpublic final void setString(String aString, String aEncoding) throws UnsupportedEncodingException
WebSocketPacketsetString in interface WebSocketPacketUnsupportedEncodingExceptionpublic final void setUTF8(String aString)
WebSocketPacketsetUTF8 in interface WebSocketPacketpublic final void setASCII(String aString)
WebSocketPacketsetASCII in interface WebSocketPacketpublic final byte[] getByteArray()
WebSocketPacketgetByteArray in interface WebSocketPacketpublic final String getString()
WebSocketPacketgetString in interface WebSocketPacketpublic final String getString(String aEncoding) throws UnsupportedEncodingException
WebSocketPacketgetString in interface WebSocketPacketUnsupportedEncodingExceptionpublic final String getUTF8()
WebSocketPacketgetUTF8 in interface WebSocketPacketnull if not convertible.public final String getASCII()
WebSocketPacketgetASCII in interface WebSocketPacketnull if not convertible.public final WebSocketFrameType getFrameType()
getFrameType in interface WebSocketPacketpublic final void setFrameType(WebSocketFrameType aFrameType)
setFrameType in interface WebSocketPacketaFrameType - the frameType to setpublic final boolean isFragmented()
isFragmented in interface WebSocketPacketpublic final boolean isComplete()
isComplete in interface WebSocketPacketpublic final void setFragment(String aString, int aIdx)
setFragment in interface WebSocketPacketpublic void packFragments()
packFragments in interface WebSocketPacketpublic final void initFragmented(int aTotal)
initFragmented in interface WebSocketPacketpublic final void setCreationDate(Date aDate)
setCreationDate in interface WebSocketPacketpublic final Date getCreationDate()
getCreationDate in interface WebSocketPacketpublic final void setTimeout(long aMilliseconds)
setTimeout in interface WebSocketPacketpublic final boolean isTimedOut()
isTimedOut in interface WebSocketPacketCopyright © 2013. All Rights Reserved.