|
RuneHive-Game
|
A static-utility class containing extension or helper methods for ByteBuffers.
More...
Static Public Member Functions | |
| static String | decodeStringCp1252 (ByteBuffer buffer, int var1, int var2) |
| static byte[] | get (ByteBuffer buffer, int length) |
Reads length bytes from the specified ByteBuffer. | |
| static String | getJString (ByteBuffer buffer) |
| Gets a newline-terminated String from the specified ByteBuffer. | |
| static int | getMedium (ByteBuffer buffer) |
Gets a 24-bit medium integer from the specified ByteBuffer, this method does not mark the ByteBuffers current position. | |
| static int | getSmart (final ByteBuffer buffer) |
Reads a 'smart' (either a byte or short depending on the value) from the specified buffer. | |
| static String | getString (ByteBuffer buffer) |
| Gets a null-terminated String from the specified ByteBuffer. | |
| static String | getString (ByteBuffer buffer, char terminator) |
Gets a String from the specified ByteBuffer, the ByteBuffer will continue to get until the specified terminator is reached. | |
| static void | putSmart (ByteBuffer buffer, int value) |
Puts a 'smart' (either a byte or short. | |
| static String | readStringCp1252NullTerminated (ByteBuffer buffer) |
Static Public Attributes | |
| static final char[] | cp1252AsciiExtension = new char[]{'€', '\u0000', '‚', 'ƒ', '„', '…', '†', '‡', 'ˆ', '‰', 'Š', '‹', 'Œ', '\u0000', 'Ž', '\u0000', '\u0000', '‘', '’', '“', '”', '•', '–', '—', '˜', '™', 'š', '›', 'œ', '\u0000', 'ž', 'Ÿ'} |
| static final char | DEFAULT_STRING_TERMINATOR = '\0' |
The default String terminator, equal to 0 and otherwise known as the 'null' String terminator. | |
| static final char | J_STRING_TERMINATOR = '\n' |
The terminator used within the client, equal to 10 and otherwise know as the Jagex String terminator. | |
Private Member Functions | |
| ByteBufferUtil () | |
| Sole private constructor to discourage instantiation of this class. | |
A static-utility class containing extension or helper methods for ByteBuffers.
Definition at line 12 of file ByteBufferUtil.java.
|
private |
Sole private constructor to discourage instantiation of this class.
Definition at line 169 of file ByteBufferUtil.java.
|
static |
Definition at line 69 of file ByteBufferUtil.java.
References cp1252AsciiExtension.
Referenced by readStringCp1252NullTerminated().
|
static |
Reads length bytes from the specified ByteBuffer.
| buffer | The ByteBuffer to read from. |
| length | The amount of bytes to read. |
Definition at line 102 of file ByteBufferUtil.java.
|
static |
Gets a newline-terminated String from the specified ByteBuffer.
| buffer | The ByteBuffer to read from. |
Definition at line 53 of file ByteBufferUtil.java.
References getString(), and J_STRING_TERMINATOR.
|
static |
Gets a 24-bit medium integer from the specified ByteBuffer, this method does not mark the ByteBuffers current position.
| buffer | The ByteBuffer to read from. |
Definition at line 33 of file ByteBufferUtil.java.
Referenced by com.runehive.fs.cache.archive.Archive.decode(), com.runehive.fs.cache.decoder.ObjectDefinitionDecoder.decode(), com.runehive.fs.cache.Index.decode(), and com.runehive.fs.cache.Sector.decode().
|
static |
Reads a 'smart' (either a byte or short depending on the value) from the specified buffer.
| buffer | The buffer. |
Definition at line 138 of file ByteBufferUtil.java.
Referenced by com.runehive.fs.cache.decoder.RegionDecoder.parseGameObject().
|
static |
Gets a null-terminated String from the specified ByteBuffer.
| buffer | The ByteBuffer to read from. |
Definition at line 43 of file ByteBufferUtil.java.
References DEFAULT_STRING_TERMINATOR, and getString().
Referenced by getJString(), and getString().
|
static |
Gets a String from the specified ByteBuffer, the ByteBuffer will continue to get until the specified terminator is reached.
We use a ByteArrayOutputStream as it is self expanding. We don't want to waste precious time determining a fixed length for the String.
| buffer | The ByteBuffer to read from. |
| terminator | The terminator which denotes when to stop reading. |
Definition at line 119 of file ByteBufferUtil.java.
|
static |
Puts a 'smart' (either a byte or short.
| buffer | The buffer. |
| value | The value to write. |
Definition at line 156 of file ByteBufferUtil.java.
|
static |
Definition at line 57 of file ByteBufferUtil.java.
References decodeStringCp1252().
Referenced by com.runehive.fs.cache.decoder.ObjectDefinitionDecoder.decode().
|
static |
Definition at line 92 of file ByteBufferUtil.java.
Referenced by decodeStringCp1252().
|
static |
The default String terminator, equal to 0 and otherwise known as the 'null' String terminator.
Definition at line 24 of file ByteBufferUtil.java.
Referenced by getString().
|
static |
The terminator used within the client, equal to 10 and otherwise know as the Jagex String terminator.
Definition at line 18 of file ByteBufferUtil.java.
Referenced by getJString().