Package mgui.io.util
Class EndianCorrectOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
java.io.DataOutputStream
mgui.io.util.EndianCorrectOutputStream
- All Implemented Interfaces:
java.io.Closeable,java.io.DataOutput,java.io.Flushable,java.lang.AutoCloseable
public class EndianCorrectOutputStream
extends java.io.DataOutputStream
EndianCorrectOutputStream extends DataOutputStream; it will optionally flip
bytes to write little endian data correctly.
-
Field Summary
Fields inherited from class java.io.DataOutputStream
writtenFields inherited from class java.io.FilterOutputStream
out -
Constructor Summary
Constructors Constructor Description EndianCorrectOutputStream(java.io.OutputStream os, boolean be)Constructor for an OutputStream.EndianCorrectOutputStream(java.lang.String filename, boolean be)Constructor for a disk file. -
Method Summary
Modifier and Type Method Description doubleflipDouble(double val)flipDouble will flip the byte order of a doublefloatflipFloat(float val)flipFloat will flip the byte order of a floatintflipInt(int val)flipInt will flip the byte order of an intlongflipLong(long val)flipLong will flip the byte order of a longshortflipShort(short val)flipShort will byte flip a shortvoidwriteDoubleCorrect(double val)writeDoubleCorrect will write a double to the streamvoidwriteFloatCorrect(float val)writeFloatCorrect will write a float to the streamvoidwriteIntCorrect(int val)writeIntCorrect will write an int to the streamvoidwriteLongCorrect(long val)writeLongCorrect will write a long to the streamvoidwriteShortCorrect(short val)writeShortCorrect will write a short to the streamMethods inherited from class java.io.DataOutputStream
flush, size, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTFMethods inherited from class java.io.FilterOutputStream
close, writeMethods inherited from class java.io.OutputStream
nullOutputStreamMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.io.DataOutput
write
-
Constructor Details
-
EndianCorrectOutputStream
public EndianCorrectOutputStream(java.lang.String filename, boolean be) throws java.io.FileNotFoundException, java.lang.SecurityExceptionConstructor for a disk file.- Parameters:
filename- filename for datafilebe- -- endian flag: if be (big endian) is false bytes will be flipped on write- Throws:
java.io.FileNotFoundExceptionjava.lang.SecurityException
-
EndianCorrectOutputStream
public EndianCorrectOutputStream(java.io.OutputStream os, boolean be)Constructor for an OutputStream.- Parameters:
is- OutputStream to write data tobe- -- endian flag: if be (big endian) is false bytes will be flipped on write- Throws:
java.io.FileNotFoundException
-
-
Method Details
-
writeShortCorrect
public void writeShortCorrect(short val) throws java.io.IOExceptionwriteShortCorrect will write a short to the stream- Throws:
java.io.IOException
-
flipShort
public short flipShort(short val)flipShort will byte flip a short -
writeIntCorrect
public void writeIntCorrect(int val) throws java.io.IOExceptionwriteIntCorrect will write an int to the stream- Throws:
java.io.IOException
-
flipInt
public int flipInt(int val)flipInt will flip the byte order of an int -
writeLongCorrect
public void writeLongCorrect(long val) throws java.io.IOExceptionwriteLongCorrect will write a long to the stream- Throws:
java.io.IOException
-
flipLong
public long flipLong(long val)flipLong will flip the byte order of a long -
writeFloatCorrect
public void writeFloatCorrect(float val) throws java.io.IOExceptionwriteFloatCorrect will write a float to the stream- Throws:
java.io.IOException
-
flipFloat
public float flipFloat(float val) throws java.io.IOExceptionflipFloat will flip the byte order of a float- Throws:
java.io.IOException
-
writeDoubleCorrect
public void writeDoubleCorrect(double val) throws java.io.IOExceptionwriteDoubleCorrect will write a double to the stream- Throws:
java.io.IOException
-
flipDouble
public double flipDouble(double val)flipDouble will flip the byte order of a double
-