Class DataBuffer

java.lang.Object
org.applecommander.util.DataBuffer

public class DataBuffer extends Object
A DataBuffer is a bunch of bytes with Apple II knowledge. This shares the technical details as well as the actual image data across all components in the application. There are two sets of accessors get/put the index the buffer and read/write that navigate via position. Note that read and write can overrun the buffer and generate an error.
  • Method Details

    • wrap

      public static DataBuffer wrap(byte[] data)
    • wrap

      public static DataBuffer wrap(int... bytes)
    • create

      public static DataBuffer create(int size)
    • slice

      public DataBuffer slice(int offset, int length)
    • limit

      public int limit()
    • limit

      public void limit(int newLimit)
    • matches

      public boolean matches(int offset, byte... data)
    • getUnsignedByte

      public int getUnsignedByte(int index)
    • getUnsignedShort

      public int getUnsignedShort(int index)
    • getUnsignedShort3

      public int getUnsignedShort3(int index)
      Retrieve a 3 byte number (as in ProDOS EOF values).
    • getUnsignedShortBE

      public int getUnsignedShortBE(int index)
    • getInt

      public int getInt(int index)
    • getIntBE

      public int getIntBE(int index)
    • get

      public void get(int position, byte[] data)
    • getFixedLengthString

      public String getFixedLengthString(int index, int length)
    • put

      public void put(int offset, DataBuffer data)
    • putByte

      public void putByte(int offset, int value)
    • putBytes

      public void putBytes(int offset, int... values)
    • isBitSet

      public boolean isBitSet(int index, int bit)
      Determine if a specific bit is set.
    • hasRemaining

      public boolean hasRemaining()
    • position

      public int position()
    • position

      public void position(int n)
    • readUnsignedByte

      public int readUnsignedByte()
    • readUnsignedShort

      public int readUnsignedShort()
    • readUnsignedShortBE

      public int readUnsignedShortBE()
      Read an short but in big endian format. Used for marker bytes so they "look" as expected in program code.
    • read

      public void read(byte[] data)
    • readInt

      public int readInt()
    • readIntBE

      public int readIntBE()
      Read an int but in big endian format. Used for marker bytes so they "look" as expected in program code.
    • readBuffer

      public DataBuffer readBuffer(int length)
    • readFixedLengthString

      public String readFixedLengthString(int length)
    • readPascalString

      public String readPascalString(int maxLength)
    • writeByte

      public void writeByte(int value)