Package com.reportmill.base
Class RMData
- java.lang.Object
- 
- com.reportmill.base.RMObject
- 
- com.reportmill.base.RMData
 
 
- 
- All Implemented Interfaces:
- RMArchiver.Archiving,- java.io.Serializable,- java.lang.Cloneable
 - Direct Known Subclasses:
- RMFlashBuffer
 
 public class RMData extends RMObject implements java.io.Serializable 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:
- Serialized Form
 
- 
- 
Constructor SummaryConstructors Constructor Description RMData()Creates an empty RMData.RMData(byte[] bytes)Creates an RMData with the given byte array.RMData(byte[] bytes, int len)Creates an RMData with the given byte array (only to the given length).RMData(int capacity)Creates an empty RMData with the given capacity.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description RMDataappend(byte[] bytes)Appends raw binary from byte array to data.RMDataappend(byte[] bytes, int offset, int length)Appends raw binary from byte array to data.RMDataappend(char c)Append common types as ASCII.RMDataappend(char[] str)Append the given char array.RMDataappend(char[] str, int offset, int length)Appends the given char array.RMDataappend(double d)Appends the given double.RMDataappend(float f)Appends the given float.RMDataappend(int anInt)Appends an int string to the data.RMDataappend(RMData data)Appends raw binary from given data to data.RMDataappend(java.lang.Object o)Appends an object's string representation to the data.RMDataappend(java.lang.String aString)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.bytebyteAt(int index)Returns the specific byte at the given index.intcapacity()Returns the size of the internal byte array.java.lang.Objectclone()Standard clone implementation.voidensureCapacity(int minimumCapacity)Makes sure internal byte array is at least a given size.booleanequals(java.lang.Object anObj)Standard equals implementation.voidflateCompressedData()Flate compresses data.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.static RMDatagetData(java.lang.Object aSource)Returns an RMData for the given File, String path, InputStream, URL, byte[], etc.java.lang.ObjectinitWithArchiver(RMArchiver anArchiver)Legacy unarchival.java.io.InputStreaminputStream()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, RMData 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.voidreplace(int start, int end, byte[] bytes, int offset, int length)Replace raw binary from byte array in data.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[]toByteArray()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.java.lang.StringtoString()Returns the string initialized from the data's bytes (ISO Latin).java.lang.StringtoString(int start, int end, java.lang.String encoding)Returns the string initialized from the data's bytes in the given encoding.voidwriteToFile(java.lang.String aPath)Writes data to file.- 
Methods inherited from class com.reportmill.base.RMObjectcopy, didChange, didUndo, getAnimAttribute, getClassNameShort, undoClone, undoCopy, undoEquals
 
- 
 
- 
- 
- 
Constructor Detail- 
RMDatapublic RMData() Creates an empty RMData.
 - 
RMDatapublic RMData(int capacity) Creates an empty RMData with the given capacity.
 - 
RMDatapublic RMData(byte[] bytes) Creates an RMData with the given byte array.
 - 
RMDatapublic RMData(byte[] bytes, int len)Creates an RMData with the given byte array (only to the given length).
 
- 
 - 
Method Detail- 
getDatapublic static RMData getData(java.lang.Object aSource) Returns an RMData for the given File, String path, InputStream, URL, byte[], etc.
 - 
getBytespublic byte[] getBytes() Returns the bytes in the data.
 - 
byteAtpublic byte byteAt(int index) Returns the specific byte at the given index.
 - 
lengthpublic int length() Returns the length of the data.
 - 
inputStreampublic java.io.InputStream inputStream() Returns an input stream of this data's bytes.
 - 
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.
 - 
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.
 - 
toStringpublic java.lang.String toString() Returns the string initialized from the data's bytes (ISO Latin).- Overrides:
- toStringin class- java.lang.Object
 
 - 
toStringpublic java.lang.String toString(int start, int end, java.lang.String encoding)Returns the string initialized from the data's bytes in the given encoding.
 - 
appendpublic RMData append(char c) Append common types as ASCII.
 - 
appendpublic RMData append(char[] str) Append the given char array.
 - 
appendpublic RMData append(char[] str, int offset, int length) Appends the given char array.
 - 
appendpublic RMData append(double d) Appends the given double.
 - 
appendpublic RMData append(float f) Appends the given float.
 - 
appendpublic RMData append(int anInt) Appends an int string to the data.
 - 
appendpublic RMData append(java.lang.Object o) Appends an object's string representation to the data.
 - 
appendpublic RMData append(java.lang.String aString) Appends a string to the data.
 - 
appendpublic RMData append(byte[] bytes) Appends raw binary from byte array to data.
 - 
appendpublic RMData append(byte[] bytes, int offset, int length) Appends raw binary from byte array to data.
 - 
insertpublic void insert(int index, RMData data)Inserts 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.
 - 
flateCompressedDatapublic void flateCompressedData() Flate compresses data.
 - 
writeToFilepublic void writeToFile(java.lang.String aPath) Writes data to file.
 - 
capacitypublic int capacity() Returns the size of the internal byte array.
 - 
ensureCapacitypublic void ensureCapacity(int minimumCapacity) Makes sure internal byte array is at least a given size.
 - 
equalspublic boolean equals(java.lang.Object anObj) Standard equals implementation.- Overrides:
- equalsin class- java.lang.Object
 
 - 
clonepublic java.lang.Object clone() Standard clone implementation.
 - 
initWithArchiverpublic java.lang.Object initWithArchiver(RMArchiver anArchiver) Legacy unarchival.- Specified by:
- initWithArchiverin interface- RMArchiver.Archiving
- Overrides:
- initWithArchiverin class- RMObject
 
 
- 
 
-