public class LEDataOutputStream extends Object implements DataOutput
LEDataOutputStream.java
copyright (c) 1998-2007 Roedy Green, Canadian Mind Products #101 - 2536 Wark Street Victoria, BC Canada V8T 4G8 hel: (250) 361-9093 mailto:roedyg@mindprod.com http://mindprod.com
Version 1.0 1998 January 6
1.1 1998 January 7 -officially implements DataInput
1.2 1998 January 9 - add LERandomAccessFile
1.3 1998 August 28 1.4 1998 November 10 - add new address and phone.
1.5 1999 October 8 - use com.mindprod.ledatastream package name. Very similar to DataOutputStream except it writes little-endian instead of big-endian binary data. We can't extend DataOutputStream directly since it has only final methods. This forces us implement LEDataOutputStream with a DataOutputStream object, and use wrapper methods.
| Modifier and Type | Field and Description |
|---|---|
protected DataOutputStream |
dis
to get at big-Endian write methods of DataOutPutStream.
|
protected byte[] |
work
work array for composing output.
|
| Constructor and Description |
|---|
LEDataOutputStream(OutputStream out)
constructor.
|
LEDataOutputStream(String filename) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close stream.
|
void |
flush()
Flush stream without closing.
|
int |
size()
Get size of stream.
|
void |
write(byte[] ba)
Write out an array of bytes.
|
void |
write(byte[] ba,
int off,
int len)
Writes out part of an array of bytes.
|
void |
write(int ib)
This method writes only one byte, even though it says int (non-Javadoc)
|
void |
writeBoolean(boolean v)
Write a booleans as one byte.
|
void |
writeBoolean(boolean[] v) |
void |
writeBoolean(boolean[] v,
int startPos,
int len) |
void |
writeByte(byte[] v) |
void |
writeByte(byte[] v,
int startPos,
int len) |
void |
writeByte(int v)
write a byte.
|
void |
writeBytes(String s)
Write a string.
|
void |
writeChar(char[] v) |
void |
writeChar(char[] v,
int startPos,
int len) |
void |
writeChar(int v)
Write a char.
|
void |
writeChars(String s)
Write a string, not a char[].
|
void |
writeDouble(double v)
Write a double.
|
void |
writeDouble(double[] v) |
void |
writeDouble(double[] v,
int startPos,
int len) |
void |
writeFloat(float v)
Write a float.
|
void |
writeFloat(float[] v) |
void |
writeFloat(float[] v,
int startPos,
int len) |
void |
writeInt(int v)
Write an int, 32-bits.
|
void |
writeInt(int[] v) |
void |
writeInt(int[] v,
int startPos,
int len) |
void |
writeLong(long v)
Write a long, 64-bits.
|
void |
writeLong(long[] v) |
void |
writeLong(long[] v,
int startPos,
int len) |
void |
writeShort(int v)
Write short, 16-bits.
|
void |
writeShort(short[] v) |
void |
writeShort(short[] v,
int startPos,
int len) |
void |
writeUTF(String s)
Write a string as a UTF counted string.
|
protected final DataOutputStream dis
protected final byte[] work
public LEDataOutputStream(OutputStream out)
out - the outputstream we write little endian binary data onto.public LEDataOutputStream(String filename) throws FileNotFoundException
FileNotFoundExceptionpublic final void close()
throws IOException
IOException - if close fails.public void flush()
throws IOException
IOException - if flush fails.public final int size()
public final void write(int ib)
throws IOException
write in interface DataOutputib - the byte to write.IOException - if write fails.DataOutput.write(int)public final void write(byte[] ba)
throws IOException
write in interface DataOutputIOException - if write fails.DataOutput.write(byte[])public final void write(byte[] ba,
int off,
int len)
throws IOException
write in interface DataOutputIOException - if write fails.DataOutput.write(byte[],int,int)public final void writeBoolean(boolean v)
throws IOException
writeBoolean in interface DataOutputv - boolean to write.IOException - if write fails.DataOutput.writeBoolean(boolean)public final void writeBoolean(boolean[] v,
int startPos,
int len)
throws IOException
IOExceptionpublic final void writeBoolean(boolean[] v)
throws IOException
IOExceptionpublic final void writeByte(int v)
throws IOException
writeByte in interface DataOutputv - the byte to write.IOException - if write fails.DataOutput.writeByte(int)public final void writeByte(byte[] v,
int startPos,
int len)
throws IOException
IOExceptionpublic final void writeByte(byte[] v)
throws IOException
IOExceptionpublic final void writeBytes(String s) throws IOException
writeBytes in interface DataOutputs - the string to write.IOException - if write fails.DataOutput.writeBytes(java.lang.String)public final void writeChar(int v)
throws IOException
writeChar in interface DataOutputv - the char to writeIOException - if write fails.public final void writeChar(char[] v,
int startPos,
int len)
throws IOException
IOExceptionpublic final void writeChar(char[] v)
throws IOException
IOExceptionpublic final void writeChars(String s) throws IOException
writeChars in interface DataOutputIOException - if write fails.public final void writeDouble(double v)
throws IOException
writeDouble in interface DataOutputv - the double to write. Like DataOutputStream.writeDouble.IOException - if write fails.public final void writeDouble(double[] v,
int startPos,
int len)
throws IOException
IOExceptionpublic final void writeDouble(double[] v)
throws IOException
IOExceptionpublic final void writeFloat(float v)
throws IOException
writeFloat in interface DataOutputv - the float to write.IOException - if write fails.public final void writeFloat(float[] v,
int startPos,
int len)
throws IOException
IOExceptionpublic final void writeFloat(float[] v)
throws IOException
IOExceptionpublic final void writeInt(int v)
throws IOException
writeInt in interface DataOutputv - the int to writeIOException - if write fails.public final void writeInt(int[] v,
int startPos,
int len)
throws IOException
IOExceptionpublic final void writeInt(int[] v)
throws IOException
IOExceptionpublic final void writeLong(long v)
throws IOException
writeLong in interface DataOutputv - the long to writeIOException - if write fails.public final void writeLong(long[] v,
int startPos,
int len)
throws IOException
IOExceptionpublic final void writeLong(long[] v)
throws IOException
IOExceptionpublic final void writeShort(int v)
throws IOException
writeShort in interface DataOutputv - the short you want written in little endian binary formatIOException - if write fails.public final void writeShort(short[] v,
int startPos,
int len)
throws IOException
IOExceptionpublic final void writeShort(short[] v)
throws IOException
IOExceptionpublic final void writeUTF(String s) throws IOException
writeUTF in interface DataOutputs - the string to write.IOException - if write fails.DataOutput.writeUTF(java.lang.String)Copyright © 2000–2016 DFKI GmbH. All rights reserved.