Package com.reportmill.base
Class RMDataReader
- java.lang.Object
- 
- com.reportmill.base.RMDataReader
 
- 
 public class RMDataReader extends java.lang.ObjectThis class helps read encoded basic data types, from a raw byte stream. Types include signed or unsigned, big-endian or little endian, chars, shorts and ints.
- 
- 
Constructor SummaryConstructors Constructor Description RMDataReader(byte[] bytes)Creates a data reader from the given bytes.RMDataReader(byte[] bytes, int offset, int length)Creates a data reader from the given bytes with the given offset and length.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.bytebyteAt(int index)Returns the specific byte at the given index.byte[]bytes()Returns the bytes.char[]charArrayAt(int index, int len)Returns the char array at the given byte index with the given length.voidgetBytes(byte[] bytes, int start, int end)Copies bytes from this to given byte array in given range.voidgetBytes(byte[] bytes, int start, int end, int destStart)Copies bytes from this to given byte array in given range.static RMDataReadergetReader(java.lang.Object aSource)Returns a data reader from the given source File, String path, InputStream, byte[], etc.static RMDataReadergetReader(java.lang.Object aSource, int offset, int length)Returns a data reader from the given source File, String path, InputStream, byte[], etc.intlength()Returns the length of the bytes for the given reader.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.intoffset()Returns the offset of the bytes for the reader.byte[]toByteArray()Returns a byte array for the reader.byte[]toByteArray(int start, int end)Returns a byte array for the reader.java.lang.StringtoString()Returns the reader's bytes as a string.java.lang.StringtoString(int start, int end, java.lang.String encoding)Returns the reader's bytes as a string in the given encoding.shortubyteAt(int index)Returns the specific unsigned byte at the given index.
 
- 
- 
- 
Method Detail- 
getReaderpublic static RMDataReader getReader(java.lang.Object aSource) Returns a data reader from the given source File, String path, InputStream, byte[], etc.
 - 
getReaderpublic static RMDataReader getReader(java.lang.Object aSource, int offset, int length) Returns a data reader from the given source File, String path, InputStream, byte[], etc.
 - 
bytespublic byte[] bytes() Returns the bytes.
 - 
byteAtpublic byte byteAt(int index) Returns the specific byte at the given index.
 - 
ubyteAtpublic short ubyteAt(int index) Returns the specific unsigned byte at the given index.
 - 
offsetpublic int offset() Returns the offset of the bytes for the reader.
 - 
lengthpublic int length() Returns the length of the bytes for the given reader.
 - 
toByteArraypublic byte[] toByteArray() Returns a byte array for the reader.
 - 
toByteArraypublic byte[] toByteArray(int start, int end)Returns a byte array for the reader.
 - 
getBytespublic void getBytes(byte[] bytes, int start, int end)Copies bytes from this to given byte array in given range.
 - 
getBytespublic void getBytes(byte[] bytes, int start, int end, int destStart)Copies bytes from this to given byte array in given range.
 - 
toStringpublic java.lang.String toString() Returns the reader's bytes as a string.- Overrides:
- toStringin class- java.lang.Object
 
 - 
toStringpublic java.lang.String toString(int start, int end, java.lang.String encoding)Returns the reader's bytes as a string in the given encoding.
 - 
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.
 
- 
 
-