Package io.github.joealisson.mmocore
Class WritableBuffer
- java.lang.Object
-
- io.github.joealisson.mmocore.WritableBuffer
-
- All Implemented Interfaces:
Buffer
- Direct Known Subclasses:
InternalWritableBuffer
public abstract class WritableBuffer extends java.lang.Object implements Buffer
-
-
Constructor Summary
Constructors Constructor Description WritableBuffer()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidwriteByte(boolean value)Write boolean to the buffer.abstract voidwriteByte(byte value)Write a byte to the buffer.voidwriteByte(int value)Write a int to the buffer, the int is casted to a byte;abstract voidwriteBytes(byte... value)Write byte[] to the buffer.abstract voidwriteChar(char value)Write char to the buffer.
16 bit charabstract voidwriteDouble(double value)Write double to the buffer.abstract voidwriteFloat(float value)Write float to the buffer.voidwriteInt(boolean value)Write boolean to the buffer.abstract voidwriteInt(int value)Write int to the buffer.abstract voidwriteLong(long value)Write long to the buffer.voidwriteShort(boolean value)Write boolean to the buffer.voidwriteShort(int value)Write short to the buffer.abstract voidwriteShort(short value)Write short to the buffer.voidwriteSizedString(java.lang.CharSequence text)Write String to the buffer preceded by a short 16 bit with String length and no null termination.voidwriteString(java.lang.CharSequence text)Write a String to the buffer with a null termination (\000).
-
-
-
Method Detail
-
writeByte
public abstract void writeByte(byte value)
Write a byte to the buffer.
8bit integer (00) If the underlying data array can't hold a new byte its size is increased 20%- Parameters:
value- to be written
-
writeByte
public void writeByte(int value)
Write a int to the buffer, the int is casted to a byte;- Parameters:
value- to be written
-
writeByte
public void writeByte(boolean value)
Write boolean to the buffer.
If the value is true so write a byte with value 1, otherwise 0 8bit integer (00)- Parameters:
value- to be written
-
writeBytes
public abstract void writeBytes(byte... value)
Write byte[] to the buffer.
8bit integer array (00 ...)- Parameters:
value- to be written
-
writeShort
public abstract void writeShort(short value)
Write short to the buffer.
16bit integer (00 00)- Parameters:
value- to be written
-
writeShort
public void writeShort(int value)
Write short to the buffer.
16bit integer (00 00)- Parameters:
value- to be written
-
writeShort
public void writeShort(boolean value)
Write boolean to the buffer.
If the value is true so write a byte with value 1, otherwise 0 16bit integer (00 00)- Parameters:
value- to be written
-
writeChar
public abstract void writeChar(char value)
Write char to the buffer.
16 bit char- Parameters:
value- the char to be put on data.
-
writeInt
public abstract void writeInt(int value)
Write int to the buffer.
32bit integer (00 00 00 00)- Parameters:
value- to be written
-
writeInt
public void writeInt(boolean value)
Write boolean to the buffer.
If the value is true so write a byte with value 1, otherwise 0 32bit integer (00 00 00 00)- Parameters:
value- to be written
-
writeFloat
public abstract void writeFloat(float value)
Write float to the buffer.
32bit float point number (00 00 00 00)- Parameters:
value- to be written
-
writeLong
public abstract void writeLong(long value)
Write long to the buffer.
64bit integer (00 00 00 00 00 00 00 00)- Parameters:
value- to be written
-
writeDouble
public abstract void writeDouble(double value)
Write double to the buffer.
64bit double precision float (00 00 00 00 00 00 00 00)- Parameters:
value- to be written
-
writeString
public void writeString(java.lang.CharSequence text)
Write a String to the buffer with a null termination (\000). Each character is a 16bit char- Parameters:
text- to be written
-
writeSizedString
public void writeSizedString(java.lang.CharSequence text)
Write String to the buffer preceded by a short 16 bit with String length and no null termination. Each character is a 16bit char.- Parameters:
text- to be written
-
-