Package com.inductiveautomation.rm.base
Class RMByteArray
java.lang.Object
com.inductiveautomation.rm.base.RMListenerList
com.inductiveautomation.rm.base.RMObject
com.inductiveautomation.rm.base.RMByteArray
- All Implemented Interfaces:
- RMPropertyChanger,- Serializable,- Cloneable
This class is like a StringBuffer for bytes instead of chars. It implements StringBuffer styled
 append() methods, only everything is forced into ASCII bytes.
 It is also enhanced with additional binary writing capabilities, so that many core types can be written as
 binary.
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionCreates an empty RMData.RMByteArray(byte[] theBytes) Creates an RMData with the given byte array.RMByteArray(byte[] theBytes, int aLength) Creates an RMData with the given byte array (only to the given length).RMByteArray(int aCapacity) Creates an empty RMData with the given capacity.
- 
Method SummaryModifier and TypeMethodDescriptionappend(byte[] bytes) Appends raw binary from byte array to data.append(byte[] bytes, int offset, int length) Appends raw binary from byte array to data.append(char c) Append common types as ASCII.append(char[] str) Append the given char array.append(char[] str, int offset, int length) Appends the given char array.append(double d) Appends the given double.append(float f) Appends the given float.append(int anInt) Appends an int string to the data.append(RMByteArray data) Appends raw binary from given data to data.Appends an object's string representation to the data.Appends a string to the data.voidappendByte(int aByte) Appends byte to data.voidappendInt(int anInt) Appends int to data.voidappendLittleInt(int anInt) Appends little endian int to data.voidappendLittleShort(int aShortInt) Appends little endian short to data.voidappendLittleUInt(long aUInt) Appends little endian unsigned int to data.voidappendLittleUShort(int aShort) Appends little endian unsigned short to data.voidappendShort(int aShortInt) Appends short to data.voidappendUByte(int aByte) Appends unsigned byte to data.short[]bigShortArrayAt(int index, int len) Returns the array of big endian shorts at the given byte index with the given length.shortbigShortAtIndex(int index) Returns the short at the given index (assumed to be in big endian format).longbigUIntAtIndex(int index) Returns the big endian unsigned int at the given byte index.int[]bigUShortArrayAt(int index, int len) Returns the array of big endian unsigned shorts at the given byte index with the given length.intbigUShortAtIndex(int index) Returns the big endian unsigned short at the given byte index.char[]charArrayAt(int index, int len) Returns the char array at the given byte index with the given length.clone()Standard clone implementation.booleanStandard equals implementation.voidFlate compresses data.bytegetByte(int index) Returns the specific byte at the given index.byte[]getBytes()Returns the bytes in the data.voidgetBytes(int srcBegin, int srcEnd, byte[] destBytes) Copies the bytes from this data to the given byte array.voidgetBytes(int srcBegin, int srcEnd, byte[] destBytes, int destBegin) Copies the bytes from this data to the given byte array.intReturns the size of the internal byte array.Returns an input stream of this data's bytes.voidinsert(int index, byte[] bytes) Inserts raw binary from byte array to data.voidinsert(int index, byte[] bytes, int offset, int length) Inserts raw binary from byte array to data.voidinsert(int index, RMByteArray data) Inserts raw binary from given data to data.voidinsertLittleUIntAtIndex(long aUInt, int byteIndex) Inserts little endian unsigned int to data at given index.intlength()Returns the length of the data.shortlittleShortAtIndex(int index) Returns the little endian short at the given byte index.longlittleUIntAtIndex(int index) Returns the little endian unsigned int at the given byte index.intlittleUShortAtIndex(int index) Returns the little endian unsigned short at the given byte index.voidreplace(int start, int end, byte[] bytes, int offset, int length) Replace raw binary from byte array in data.voidsetCapacity(int aMinimumCapacity) Makes sure internal byte array is at least a given size.voidsetLittleIntAtIndex(int anInt, int byteIndex) Sets little endian int to data at given index.voidsetLittleShortAtIndex(int aShortInt, int byteIndex) Sets little endian short to data at given index.voidsetLittleUShortAtIndex(int aShort, int byteIndex) Sets little endian unsigned short to data at given index.byte[]Returns a byte array for the bytes in the data.byte[]toByteArray(int start, int end) Returns a byte array for the bytes in the data.toString()Returns the string initialized from the data's bytes (ISO Latin).Returns the string initialized from the data's bytes in the given encoding.Methods inherited from class com.inductiveautomation.rm.base.RMObjectaddPropertyChangeListener, animUpdate, firePropertyChange, firePropertyChange, firePropertyChange, getPCEvent, removePropertyChangeListener, sendPropertyChangeMethods inherited from class com.inductiveautomation.rm.base.RMListenerListaddListener, getListener, getListenerCount, getListenerCount, getListenerList, getListeners, hasListeners, removeListener
- 
Constructor Details- 
RMByteArraypublic RMByteArray()Creates an empty RMData.
- 
RMByteArraypublic RMByteArray(int aCapacity) Creates an empty RMData with the given capacity.
- 
RMByteArraypublic RMByteArray(byte[] theBytes) Creates an RMData with the given byte array.
- 
RMByteArraypublic RMByteArray(byte[] theBytes, int aLength) Creates an RMData with the given byte array (only to the given length).
 
- 
- 
Method Details- 
getBytespublic byte[] getBytes()Returns the bytes in the data.
- 
lengthpublic int length()Returns the length of the data.
- 
getBytepublic byte getByte(int index) Returns the specific byte at the given index.
- 
getBytespublic void getBytes(int srcBegin, int srcEnd, byte[] destBytes) Copies the bytes from this data to the given byte array.
- 
getBytespublic void getBytes(int srcBegin, int srcEnd, byte[] destBytes, int destBegin) Copies the bytes from this data to the given byte array.
- 
getInputStreamReturns an input stream of this data's bytes.
- 
appendAppend common types as ASCII.
- 
appendAppend the given char array.
- 
appendAppends the given char array.
- 
appendAppends the given double.
- 
appendAppends the given float.
- 
appendAppends an int string to the data.
- 
appendAppends an object's string representation to the data.
- 
appendAppends a string to the data.
- 
appendAppends raw binary from given data to data.
- 
appendAppends raw binary from byte array to data.
- 
appendAppends raw binary from byte array to data.
- 
insertInserts raw binary from given data to data.
- 
insertpublic void insert(int index, byte[] bytes) Inserts raw binary from byte array to data.
- 
insertpublic void insert(int index, byte[] bytes, int offset, int length) Inserts raw binary from byte array to data.
- 
replacepublic void replace(int start, int end, byte[] bytes, int offset, int length) Replace raw binary from byte array in data.
- 
appendBytepublic void appendByte(int aByte) Appends byte to data.
- 
appendUBytepublic void appendUByte(int aByte) Appends unsigned byte to data.
- 
appendShortpublic void appendShort(int aShortInt) Appends short to data.
- 
appendLittleShortpublic void appendLittleShort(int aShortInt) Appends little endian short to data.
- 
appendLittleUShortpublic void appendLittleUShort(int aShort) Appends little endian unsigned short to data.
- 
appendIntpublic void appendInt(int anInt) Appends int to data.
- 
appendLittleIntpublic void appendLittleInt(int anInt) Appends little endian int to data.
- 
appendLittleUIntpublic void appendLittleUInt(long aUInt) Appends little endian unsigned int to data.
- 
setLittleShortAtIndexpublic void setLittleShortAtIndex(int aShortInt, int byteIndex) Sets little endian short to data at given index.
- 
setLittleUShortAtIndexpublic void setLittleUShortAtIndex(int aShort, int byteIndex) Sets little endian unsigned short to data at given index.
- 
setLittleIntAtIndexpublic void setLittleIntAtIndex(int anInt, int byteIndex) Sets little endian int to data at given index.
- 
insertLittleUIntAtIndexpublic void insertLittleUIntAtIndex(long aUInt, int byteIndex) Inserts little endian unsigned int to data at given index.
- 
bigShortAtIndexpublic short bigShortAtIndex(int index) Returns the short at the given index (assumed to be in big endian format).
- 
bigUShortAtIndexpublic int bigUShortAtIndex(int index) Returns the big endian unsigned short at the given byte index.
- 
littleShortAtIndexpublic short littleShortAtIndex(int index) Returns the little endian short at the given byte index.
- 
littleUShortAtIndexpublic int littleUShortAtIndex(int index) Returns the little endian unsigned short at the given byte index.
- 
bigUIntAtIndexpublic long bigUIntAtIndex(int index) Returns the big endian unsigned int at the given byte index.
- 
littleUIntAtIndexpublic long littleUIntAtIndex(int index) Returns the little endian unsigned int at the given byte index.
- 
charArrayAtpublic char[] charArrayAt(int index, int len) Returns the char array at the given byte index with the given length.
- 
bigShortArrayAtpublic short[] bigShortArrayAt(int index, int len) Returns the array of big endian shorts at the given byte index with the given length.
- 
bigUShortArrayAtpublic int[] bigUShortArrayAt(int index, int len) Returns the array of big endian unsigned shorts at the given byte index with the given length.
- 
getCapacitypublic int getCapacity()Returns the size of the internal byte array.
- 
setCapacitypublic void setCapacity(int aMinimumCapacity) Makes sure internal byte array is at least a given size.
- 
equalsStandard equals implementation.
- 
cloneStandard clone implementation.- Overrides:
- clonein class- RMListenerList
 
- 
toStringReturns the string initialized from the data's bytes (ISO Latin).
- 
toStringReturns the string initialized from the data's bytes in the given encoding.
- 
toByteArraypublic byte[] toByteArray()Returns a byte array for the bytes in the data.
- 
toByteArraypublic byte[] toByteArray(int start, int end) Returns a byte array for the bytes in the data.
- 
flateCompressedDatapublic void flateCompressedData()Flate compresses data.
 
-