|
Firefish 0.5.10 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object gov.lbl.dsd.util.ByteConverter
Efficient portable array conversions for high performance I/O through bulk data transfer rather than piece-wise transfer. Avoids deep non-inlined synchronized call chains in the java.io package. The following conversions are supported:
DataInputStream
and
DataOutputStream
. In fact, this is a copy&paste of the JDK 1.4.2
source code of these two classes, with efficient loops written around.
Not only for disk I/O, but also for other kinds of serialization, e.g. high bandwidth networking.
FileOutputStream.write(byte[], int, int)
, perhaps buffered.FileInputStream.read(byte[], int, int)
, perhaps buffered.
System.arraycopy(java.lang.Object, int, java.lang.Object, int, int)
, except for
the length argument which is always given in bytes!
Please don't flame for not writing redundant javadoc for each and every method.
Method Summary | |
static void |
read(byte[] src,
int srcPos,
boolean[] dest,
int destPos,
int length)
|
static void |
read(byte[] src,
int srcPos,
byte[] dest,
int destPos,
int length)
|
static void |
read(byte[] src,
int srcPos,
char[] dest,
int destPos,
int length)
|
static void |
read(byte[] src,
int srcPos,
double[] dest,
int destPos,
int length)
|
static void |
read(byte[] src,
int srcPos,
float[] dest,
int destPos,
int length)
|
static void |
read(byte[] src,
int srcPos,
int[] dest,
int destPos,
int length)
|
static void |
read(byte[] src,
int srcPos,
long[] dest,
int destPos,
int length)
|
static void |
read(byte[] src,
int srcPos,
short[] dest,
int destPos,
int length)
|
static boolean |
readBoolean(byte[] src,
int srcPos)
|
static byte |
readByte(byte[] src,
int srcPos)
|
static String |
readBytes(byte[] src,
int srcPos,
char[] buffer,
int length)
The inverse to writeBytes(String, int, byte[], int, int) ; each single byte is converted to a 2 byte char. |
static char |
readChar(byte[] src,
int srcPos)
|
static String |
readChars(byte[] src,
int srcPos,
char[] buffer,
int length)
|
static double |
readDouble(byte[] src,
int srcPos)
|
static float |
readFloat(byte[] src,
int srcPos)
|
static int |
readInt(byte[] src,
int srcPos)
|
static long |
readLong(byte[] src,
int srcPos)
|
static short |
readShort(byte[] src,
int srcPos)
|
static int |
readUnsignedByte(byte[] src,
int srcPos)
|
static int |
readUnsignedShort(byte[] src,
int srcPos)
|
static int |
readUTF(byte[] src,
int srcPos,
char[] dest,
int destPos,
int[] srcPosNext)
|
static String |
readUTF(byte[] src,
int srcPos,
int[] srcPosNext)
|
static void |
write(boolean[] src,
int srcPos,
byte[] dest,
int destPos,
int length)
|
static void |
write(boolean v,
byte[] dest,
int destPos)
|
static void |
write(byte[] src,
int srcPos,
byte[] dest,
int destPos,
int length)
|
static void |
write(byte v,
byte[] dest,
int destPos)
|
static void |
write(char[] src,
int srcPos,
byte[] dest,
int destPos,
int length)
|
static void |
write(char v,
byte[] dest,
int destPos)
|
static void |
write(double[] src,
int srcPos,
byte[] dest,
int destPos,
int length)
|
static void |
write(double src,
byte[] dest,
int destPos)
|
static void |
write(float[] src,
int srcPos,
byte[] dest,
int destPos,
int length)
|
static void |
write(float v,
byte[] dest,
int destPos)
|
static void |
write(int[] src,
int srcPos,
byte[] dest,
int destPos,
int length)
|
static void |
write(int v,
byte[] dest,
int destPos)
|
static void |
write(long[] src,
int srcPos,
byte[] dest,
int destPos,
int length)
|
static void |
write(long v,
byte[] dest,
int destPos)
|
static void |
write(short[] src,
int srcPos,
byte[] dest,
int destPos,
int length)
|
static void |
write(short v,
byte[] dest,
int destPos)
|
static void |
writeBytes(String src,
int srcPos,
byte[] dest,
int destPos,
int length)
Writes out the string to the underlying byte array as a sequence of bytes. |
static void |
writeChars(String src,
int srcPos,
byte[] dest,
int destPos,
int length)
|
static int |
writeUTF(String src,
int srcPos,
byte[] dest,
int destPos,
int length)
Writes a string to the underlying output stream using UTF-8 encoding in a machine-independent manner. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static void read(byte[] src, int srcPos, byte[] dest, int destPos, int length)
public static void read(byte[] src, int srcPos, char[] dest, int destPos, int length)
public static void read(byte[] src, int srcPos, double[] dest, int destPos, int length)
public static void read(byte[] src, int srcPos, float[] dest, int destPos, int length)
public static void read(byte[] src, int srcPos, int[] dest, int destPos, int length)
public static void read(byte[] src, int srcPos, long[] dest, int destPos, int length)
public static void read(byte[] src, int srcPos, short[] dest, int destPos, int length)
public static void read(byte[] src, int srcPos, boolean[] dest, int destPos, int length)
public static boolean readBoolean(byte[] src, int srcPos)
public static byte readByte(byte[] src, int srcPos)
public static String readBytes(byte[] src, int srcPos, char[] buffer, int length)
writeBytes(String, int, byte[], int, int)
; each single byte is converted to a 2 byte char.
public static char readChar(byte[] src, int srcPos)
public static String readChars(byte[] src, int srcPos, char[] buffer, int length)
public static double readDouble(byte[] src, int srcPos)
public static float readFloat(byte[] src, int srcPos)
public static int readInt(byte[] src, int srcPos)
public static long readLong(byte[] src, int srcPos)
public static short readShort(byte[] src, int srcPos)
public static int readUnsignedByte(byte[] src, int srcPos)
public static int readUnsignedShort(byte[] src, int srcPos)
public static String readUTF(byte[] src, int srcPos, int[] srcPosNext) throws UTFDataFormatException
UTFDataFormatException
public static int readUTF(byte[] src, int srcPos, char[] dest, int destPos, int[] srcPosNext) throws UTFDataFormatException
UTFDataFormatException
public static void write(byte[] src, int srcPos, byte[] dest, int destPos, int length)
public static void write(char[] src, int srcPos, byte[] dest, int destPos, int length)
public static void write(double[] src, int srcPos, byte[] dest, int destPos, int length)
public static void write(float[] src, int srcPos, byte[] dest, int destPos, int length)
public static void write(int[] src, int srcPos, byte[] dest, int destPos, int length)
public static void write(long[] src, int srcPos, byte[] dest, int destPos, int length)
public static void write(short[] src, int srcPos, byte[] dest, int destPos, int length)
public static void write(boolean[] src, int srcPos, byte[] dest, int destPos, int length)
public static void write(byte v, byte[] dest, int destPos)
public static void write(char v, byte[] dest, int destPos)
public static void write(double src, byte[] dest, int destPos)
public static void write(float v, byte[] dest, int destPos)
public static void write(int v, byte[] dest, int destPos)
public static void write(long v, byte[] dest, int destPos)
public static void write(short v, byte[] dest, int destPos)
public static void write(boolean v, byte[] dest, int destPos)
public static void writeBytes(String src, int srcPos, byte[] dest, int destPos, int length)
public static void writeChars(String src, int srcPos, byte[] dest, int destPos, int length)
public static int writeUTF(String src, int srcPos, byte[] dest, int destPos, int length) throws UTFDataFormatException
First, two bytes are written to the output stream as if by the
writeShort
method giving the number of bytes to
follow. This value is the number of bytes actually written out,
not the length of the string. Following the length, each character
of the string is output, in sequence, using the UTF-8 encoding
for the character. If no exception is thrown, the counter
written
is incremented by the total number of
bytes written to the output stream. This will be at least two
plus the length of str
, and at most two plus
thrice the length of str
.
IOException
- if an I/O error occurs.
UTFDataFormatException
|
Firefish 0.5.10 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |