Package org.applecommander.util
Class DataBuffer
java.lang.Object
org.applecommander.util.DataBuffer
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 Summary
Modifier and TypeMethodDescriptionbyte[]asBytes()A utility method to pull the buffer as bytes.static DataBuffercreate(int size) booleanvoidfill(int value) voidget(int position, byte[] data) getFixedLengthString(int index, int length) intgetInt(int index) intgetIntBE(int index) intgetSignedShort(int index) intgetUnsignedByte(int index) intgetUnsignedShort(int index) intgetUnsignedShort3(int index) Retrieve a 3 byte number (as in ProDOS EOF values).intgetUnsignedShortBE(int index) booleanbooleanisBitSet(int index, int bit) Determine if a specific bit is set.intlimit()voidlimit(int newLimit) booleanmatches(int offset, byte... data) intposition()voidposition(int n) voidput(int offset, DataBuffer data) voidputByte(int offset, int value) voidputBytes(int offset, int... values) voidputShort(int offset, short value) voidputUnsignedShort(int offset, int value) voidread(byte[] data) readBuffer(int length) readFixedLengthString(int length) intreadInt()intRead an int but in big endian format.readPascalString(int maxLength) intintintRead an short but in big endian format.slice(int offset, int length) static DataBufferwrap(byte[] data) static DataBufferwrap(byte[] data, int offset, int length) static DataBufferwrap(int... bytes) voidwriteByte(int value)
-
Method Details
-
wrap
-
wrap
-
wrap
-
create
-
slice
-
limit
public int limit() -
limit
public void limit(int newLimit) -
matches
public boolean matches(int offset, byte... data) -
equals
-
asBytes
public byte[] asBytes()A utility method to pull the buffer as bytes. -
fill
public void fill(int value) -
getUnsignedByte
public int getUnsignedByte(int index) -
getSignedShort
public int getSignedShort(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
-
put
-
putByte
public void putByte(int offset, int value) -
putBytes
public void putBytes(int offset, int... values) -
putUnsignedShort
public void putUnsignedShort(int offset, int value) -
putShort
public void putShort(int offset, short value) -
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
-
readFixedLengthString
-
readPascalString
-
writeByte
public void writeByte(int value)
-