public class BufferedDataOutputStream extends BufferedOutputStream implements ArrayDataOutput
Note that there is substantial duplication of code to minimize method invocations. However simple output methods were used where empirical tests seemed to indicate that the simpler method did not cost any time. It seems likely that most of these variations will be washed out across different compilers and users who wish to tune the method for their particular system may wish to compare the the implementation of write(int[], int, int) with write(float[], int, int).
Testing and timing for this class is peformed in the nom.tam.util.test.BufferedFileTester class.
buf, countout| Constructor and Description |
|---|
BufferedDataOutputStream(OutputStream o)
Use the BufferedOutputStream constructor
|
BufferedDataOutputStream(OutputStream o,
int bufLength)
Use the BufferedOutputStream constructor
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkBuf(int need) |
void |
write(boolean[] b)
Write an array of booleans.
|
void |
write(boolean[] b,
int start,
int len)
Write a segment of an array of booleans.
|
void |
write(char[] c)
Write an array of char's.
|
void |
write(char[] c,
int start,
int len)
Write a segment of an array of char's.
|
void |
write(double[] d)
Write an array of doubles.
|
void |
write(double[] d,
int start,
int len) |
void |
write(float[] f)
Write an array of floats.
|
void |
write(float[] f,
int start,
int len) |
void |
write(int[] i)
Write an array of int's.
|
void |
write(int[] i,
int start,
int len)
Write a segment of an array of int's.
|
void |
write(long[] l)
Write an array of longs.
|
void |
write(long[] l,
int start,
int len)
Write a segement of an array of longs.
|
void |
write(short[] s)
Write an array of shorts.
|
void |
write(short[] s,
int start,
int len)
Write a segment of an array of shorts.
|
void |
write(String[] s)
Write an array of Strings -- equivalent to calling writeBytes for each string.
|
void |
write(String[] s,
int start,
int len)
Write a segment of an array of Strings.
|
void |
writeArray(Object o)
This routine provides efficient writing of arrays of any primitive type.
|
void |
writeBoolean(boolean b)
Write a boolean value
|
void |
writeByte(int b)
Write a byte value.
|
void |
writeBytes(String s)
Write a string using the local protocol to convert char's to bytes.
|
void |
writeChar(int c)
Write a char value.
|
void |
writeChars(String s)
Write a string as an array of chars.
|
void |
writeDouble(double d)
Write a double value.
|
void |
writeFloat(float f)
Write a float value.
|
void |
writeInt(int i)
Write an integer value.
|
void |
writeLong(long l)
Write a long value.
|
void |
writePrimitiveArray(Object o)
This routine provides efficient writing of arrays of any primitive type.
|
void |
writeShort(int s)
Write a short value.
|
void |
writeUTF(String s)
Write a string as a UTF.
|
flush, write, writeclose, writeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclose, flush, write, writewritepublic BufferedDataOutputStream(OutputStream o)
o - An open output stream.public BufferedDataOutputStream(OutputStream o, int bufLength)
o - An open output stream.bufLength - The buffer size.public void writeBoolean(boolean b)
throws IOException
writeBoolean in interface DataOutputb - The value to be written. Externally true is represented as
a byte of 1 and false as a byte value of 0.IOExceptionpublic void writeByte(int b)
throws IOException
writeByte in interface DataOutputIOExceptionpublic void writeInt(int i)
throws IOException
writeInt in interface DataOutputIOExceptionpublic void writeShort(int s)
throws IOException
writeShort in interface DataOutputIOExceptionpublic void writeChar(int c)
throws IOException
writeChar in interface DataOutputIOExceptionpublic void writeLong(long l)
throws IOException
writeLong in interface DataOutputIOExceptionpublic void writeFloat(float f)
throws IOException
writeFloat in interface DataOutputIOExceptionpublic void writeDouble(double d)
throws IOException
writeDouble in interface DataOutputIOExceptionpublic void writeBytes(String s) throws IOException
writeBytes in interface DataOutputs - The string to be written.IOExceptionpublic void writeChars(String s) throws IOException
writeChars in interface DataOutputIOExceptionpublic void writeUTF(String s) throws IOException
writeUTF in interface DataOutputIOExceptionpublic void writePrimitiveArray(Object o) throws IOException
o - The object to be written. It must be an array of a primitive
type, Object, or String.IOExceptionpublic void writeArray(Object o) throws IOException
writeArray in interface ArrayDataOutputo - The object to be written. It must be an array of a primitive
type, Object, or String.IOException - if the argument is not of the proper typepublic void write(boolean[] b)
throws IOException
write in interface ArrayDataOutputIOExceptionpublic void write(boolean[] b,
int start,
int len)
throws IOException
write in interface ArrayDataOutputIOExceptionpublic void write(short[] s)
throws IOException
write in interface ArrayDataOutputIOExceptionpublic void write(short[] s,
int start,
int len)
throws IOException
write in interface ArrayDataOutputIOExceptionpublic void write(char[] c)
throws IOException
write in interface ArrayDataOutputIOExceptionpublic void write(char[] c,
int start,
int len)
throws IOException
write in interface ArrayDataOutputIOExceptionpublic void write(int[] i)
throws IOException
write in interface ArrayDataOutputIOExceptionpublic void write(int[] i,
int start,
int len)
throws IOException
write in interface ArrayDataOutputIOExceptionpublic void write(long[] l)
throws IOException
write in interface ArrayDataOutputIOExceptionpublic void write(long[] l,
int start,
int len)
throws IOException
write in interface ArrayDataOutputIOExceptionpublic void write(float[] f)
throws IOException
write in interface ArrayDataOutputIOExceptionpublic void write(float[] f,
int start,
int len)
throws IOException
write in interface ArrayDataOutputIOExceptionpublic void write(double[] d)
throws IOException
write in interface ArrayDataOutputIOExceptionpublic void write(double[] d,
int start,
int len)
throws IOException
write in interface ArrayDataOutputIOExceptionpublic void write(String[] s) throws IOException
write in interface ArrayDataOutputIOExceptionpublic void write(String[] s, int start, int len) throws IOException
write in interface ArrayDataOutputIOExceptionprotected void checkBuf(int need)
throws IOException
IOExceptionCopyright © 2025 Central Laboratory of the Research Councils. All Rights Reserved.