Package de.uniluebeck.itm.tcpip
Class Storage
- java.lang.Object
-
- de.uniluebeck.itm.tcpip.Storage
-
- All Implemented Interfaces:
Serializable
public class Storage extends Object implements Serializable
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
debug()
List<Byte>
getStorageList()
Retrieve the internal list that is used to store the dataint
position()
short
readByte()
Read a byte value from the Listdouble
readDouble()
Read a Double value, that was split up into 8 bytesfloat
readFloat()
Read a Float value, that was split up into 4 bytesint
readInt()
Read a signed integer value, that was split up into 4 bytesint
readShort()
Read a short value from the listString
readStringASCII()
Read a String from the list, that was encoded using ASCIIString
readStringISOLATIN1()
Read a String from the list, that was encoded using ISO-LATIN1String
readStringUTF16BE()
Read a String from the list, that was encoded using UTF-16 Big EndianString
readStringUTF16LE()
Read a String from the list, that was encoded using UTF-16 Little EndianString
readStringUTF8()
Read a String from the list, that was encoded using UTF-8short
readUnsignedByte()
void
reset()
int
size()
Retrieve the Size of the internal storage listString
toString()
boolean
validPos()
void
writeByte(int value)
void
writeByte(short value)
Write a byte value to the List a signed value will be converted to its unsigned equivalent firstvoid
writeDouble(double value)
Write a Double to the list the value is beeing split up into 8 bytes in msb first ordervoid
writeFloat(float value)
Write a Float to the list the float value is beeing split up into 4 bytes in msb first ordervoid
writeInt(int value)
Write an signed Integer to the list the int value is being split up into 4 bytes in msb first ordervoid
writeShort(int value)
Write a signed short value to the listvoid
writeStringASCII(String value)
Write a string to the list by encoding the characters in ASCIIvoid
writeStringISOLATIN1(String value)
Write a string to the list by encoding the characters in ISO-LATIN1void
writeStringUTF16BE(String value)
Write a string to the list by encoding the characters in UTF-16 Big Endianvoid
writeStringUTF16LE(String value)
Write a string to the list by encoding the characters in UTF-16 Little Endianvoid
writeStringUTF8(String value)
Write a string to the list by encoding the characters in UTF-8void
writeUnsignedByte(int value)
void
writeUnsignedByte(short value)
-
-
-
Method Detail
-
validPos
public boolean validPos()
-
position
public int position()
-
writeByte
public void writeByte(short value) throws IllegalArgumentException
Write a byte value to the List a signed value will be converted to its unsigned equivalent first- Parameters:
value
- the byte to be written- Throws:
IllegalArgumentException
-
writeByte
public void writeByte(int value) throws IllegalArgumentException
- Throws:
IllegalArgumentException
-
readByte
public short readByte() throws IllegalStateException
Read a byte value from the List- Returns:
- the read byte as an Integer value (unsigned)
- Throws:
IllegalStateException
-
writeUnsignedByte
public void writeUnsignedByte(short value) throws IllegalArgumentException
- Throws:
IllegalArgumentException
-
writeUnsignedByte
public void writeUnsignedByte(int value) throws IllegalArgumentException
- Throws:
IllegalArgumentException
-
readUnsignedByte
public short readUnsignedByte() throws IllegalStateException
- Throws:
IllegalStateException
-
writeShort
public void writeShort(int value) throws IllegalArgumentException
Write a signed short value to the list- Parameters:
value
- the short value to be written- Throws:
IllegalArgumentException
-
readShort
public int readShort() throws IllegalStateException
Read a short value from the list- Returns:
- the read short value as an Integer
- Throws:
IllegalStateException
-
writeInt
public void writeInt(int value) throws IllegalArgumentException
Write an signed Integer to the list the int value is being split up into 4 bytes in msb first order- Parameters:
value
- the int value to be written- Throws:
IllegalArgumentException
-
readInt
public int readInt() throws IllegalStateException
Read a signed integer value, that was split up into 4 bytes- Returns:
- the read int value
- Throws:
IllegalStateException
-
writeFloat
public void writeFloat(float value) throws IllegalArgumentException
Write a Float to the list the float value is beeing split up into 4 bytes in msb first order- Parameters:
value
- the float value to be written- Throws:
IllegalArgumentException
-
readFloat
public float readFloat() throws IllegalStateException
Read a Float value, that was split up into 4 bytes- Returns:
- the read float value
- Throws:
IllegalStateException
-
writeDouble
public void writeDouble(double value) throws IllegalArgumentException
Write a Double to the list the value is beeing split up into 8 bytes in msb first order- Parameters:
value
- the double value to be written- Throws:
IllegalArgumentException
-
readDouble
public double readDouble() throws IllegalStateException
Read a Double value, that was split up into 8 bytes- Returns:
- the read double value
- Throws:
IllegalStateException
-
writeStringUTF8
public void writeStringUTF8(String value) throws IllegalArgumentException
Write a string to the list by encoding the characters in UTF-8- Parameters:
value
- the String to be written- Throws:
IllegalArgumentException
-
writeStringASCII
public void writeStringASCII(String value) throws IllegalArgumentException
Write a string to the list by encoding the characters in ASCII- Parameters:
value
- the String to be written- Throws:
IllegalArgumentException
-
writeStringISOLATIN1
public void writeStringISOLATIN1(String value) throws IllegalArgumentException
Write a string to the list by encoding the characters in ISO-LATIN1- Parameters:
value
- the String to be written- Throws:
IllegalArgumentException
-
writeStringUTF16BE
public void writeStringUTF16BE(String value) throws IllegalArgumentException
Write a string to the list by encoding the characters in UTF-16 Big Endian- Parameters:
value
- the String to be written- Throws:
IllegalArgumentException
-
writeStringUTF16LE
public void writeStringUTF16LE(String value) throws IllegalArgumentException
Write a string to the list by encoding the characters in UTF-16 Little Endian- Parameters:
value
- the String to be written- Throws:
IllegalArgumentException
-
readStringUTF8
public String readStringUTF8() throws IllegalArgumentException
Read a String from the list, that was encoded using UTF-8- Returns:
- the read String
- Throws:
IllegalArgumentException
-
readStringASCII
public String readStringASCII() throws IllegalArgumentException
Read a String from the list, that was encoded using ASCII- Returns:
- the read String
- Throws:
IllegalArgumentException
-
readStringISOLATIN1
public String readStringISOLATIN1() throws IllegalArgumentException
Read a String from the list, that was encoded using ISO-LATIN1- Returns:
- the read String
- Throws:
IllegalArgumentException
-
readStringUTF16BE
public String readStringUTF16BE() throws IllegalArgumentException
Read a String from the list, that was encoded using UTF-16 Big Endian- Returns:
- the read String
- Throws:
IllegalArgumentException
-
readStringUTF16LE
public String readStringUTF16LE() throws IllegalArgumentException
Read a String from the list, that was encoded using UTF-16 Little Endian- Returns:
- the read String
- Throws:
IllegalArgumentException
-
reset
public void reset()
-
size
public int size()
Retrieve the Size of the internal storage list- Returns:
- size of the storage list
-
getStorageList
public List<Byte> getStorageList()
Retrieve the internal list that is used to store the data- Returns:
- the internal storage list
-
debug
public String debug()
-
-