Class LittleEndianAccessor

java.lang.Object
tools.data.LittleEndianAccessor

public class LittleEndianAccessor extends Object
Provides a interface to a Little Endian stream of bytes.
Since:
Revision 323
  • Constructor Details

    • LittleEndianAccessor

      public LittleEndianAccessor(ByteArrayByteStream bs)
      Class constructor - Wraps the accessor around a stream of bytes.
      Parameters:
      bs - The byte stream to wrap the accessor around.
  • Method Details

    • readByteAsInt

      public int readByteAsInt()
    • readByte

      public final byte readByte()
      Read a single byte from the stream.
      Returns:
      The byte read.
    • readInt

      public final int readInt()
      Reads an integer from the stream.
      Returns:
      The integer read.
    • readUInt

      public final long readUInt()
    • readShort

      public final short readShort()
      Reads a short integer from the stream.
      Returns:
      The short read.
    • readUShort

      public final int readUShort()
    • readShortAsInt

      public final int readShortAsInt()
    • readChar

      public final char readChar()
      Reads a single character from the stream.
      Returns:
      The character read.
    • readLong

      public final long readLong()
      Reads a long integer from the stream.
      Returns:
      The long integer read.
    • readFloat

      public final float readFloat()
      Reads a floating point integer from the stream.
      Returns:
      The float-type integer read.
    • readDouble

      public final double readDouble()
      Reads a double-precision integer from the stream.
      Returns:
      The double-type integer read.
    • readAsciiString

      public final String readAsciiString(int n)
      Reads an ASCII string from the stream with length n.
      Parameters:
      n - Number of characters to read.
      Returns:
      The string read.
    • getBytesRead

      public final long getBytesRead()
      Gets the number of bytes read from the stream so far.
      Returns:
      A long integer representing the number of bytes read.
    • readMapleAsciiString

      public final String readMapleAsciiString()
      Reads a MapleStory convention lengthed ASCII string. This consists of a short integer telling the length of the string, then the string itself.
      Returns:
      The string read.
    • readPos

      public final Point readPos()
      Reads a MapleStory Position information. This consists of 2 short integer.
      Returns:
      The Position read.
    • read

      public final byte[] read(int num)
      Reads num bytes off the stream.
      Parameters:
      num - The number of bytes to read.
      Returns:
      An array of bytes with the length of num
    • available

      public final long available()
      Returns the number of bytes available from the stream.
    • toString

      public final String toString()
      Overrides:
      toString in class Object
      See Also:
    • toString

      public final String toString(boolean b)
    • seek

      public final void seek(long offset)
      Seek the pointer to offset
      Parameters:
      offset - The offset to seek to.
    • getPosition

      public final long getPosition()
      Get the current position of the pointer.
      Returns:
      The current position of the pointer as a long integer.
    • skip

      public final void skip(int num)
      Skip num number of bytes in the stream.
      Parameters:
      num - The number of bytes to skip.