Package com.google.common.io
Class LittleEndianDataOutputStream
- java.lang.Object
- 
- java.io.OutputStream
- 
- java.io.FilterOutputStream
- 
- com.google.common.io.LittleEndianDataOutputStream
 
 
 
- 
- All Implemented Interfaces:
- java.io.Closeable,- java.io.DataOutput,- java.io.Flushable,- java.lang.AutoCloseable
 
 @GwtIncompatible public final class LittleEndianDataOutputStream extends java.io.FilterOutputStream implements java.io.DataOutput An implementation ofDataOutputthat uses little-endian byte ordering for writingchar,short,int,float,double, andlongvalues.Note: This class intentionally violates the specification of its supertype DataOutput, which explicitly requires big-endian byte order.- Since:
- 8.0
- Author:
- Chris Nokleberg, Keith Bottner
 
- 
- 
Constructor SummaryConstructors Constructor Description LittleEndianDataOutputStream(java.io.OutputStream out)Creates aLittleEndianDataOutputStreamthat wraps the given stream.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidclose()voidwrite(byte[] b, int off, int len)voidwriteBoolean(boolean v)voidwriteByte(int v)voidwriteBytes(java.lang.String s)Deprecated.The semantics ofwriteBytes(String s)are considered dangerous.voidwriteChar(int v)Writes a char as specified byDataOutputStream.writeChar(int), except using little-endian byte order.voidwriteChars(java.lang.String s)Writes aStringas specified byDataOutputStream.writeChars(String), except each character is written using little-endian byte order.voidwriteDouble(double v)Writes adoubleas specified byDataOutputStream.writeDouble(double), except using little-endian byte order.voidwriteFloat(float v)Writes afloatas specified byDataOutputStream.writeFloat(float), except using little-endian byte order.voidwriteInt(int v)Writes anintas specified byDataOutputStream.writeInt(int), except using little-endian byte order.voidwriteLong(long v)Writes alongas specified byDataOutputStream.writeLong(long), except using little-endian byte order.voidwriteShort(int v)Writes ashortas specified byDataOutputStream.writeShort(int), except using little-endian byte order.voidwriteUTF(java.lang.String str)
 
- 
- 
- 
Constructor Detail- 
LittleEndianDataOutputStreampublic LittleEndianDataOutputStream(java.io.OutputStream out) Creates aLittleEndianDataOutputStreamthat wraps the given stream.- Parameters:
- out- the stream to delegate to
 
 
- 
 - 
Method Detail- 
writepublic void write(byte[] b, int off, int len) throws java.io.IOException - Specified by:
- writein interface- java.io.DataOutput
- Overrides:
- writein class- java.io.FilterOutputStream
- Throws:
- java.io.IOException
 
 - 
writeBooleanpublic void writeBoolean(boolean v) throws java.io.IOException - Specified by:
- writeBooleanin interface- java.io.DataOutput
- Throws:
- java.io.IOException
 
 - 
writeBytepublic void writeByte(int v) throws java.io.IOException - Specified by:
- writeBytein interface- java.io.DataOutput
- Throws:
- java.io.IOException
 
 - 
writeBytes@Deprecated public void writeBytes(java.lang.String s) throws java.io.IOException Deprecated.The semantics ofwriteBytes(String s)are considered dangerous. Please usewriteUTF(String s),writeChars(String s)or another write method instead.- Specified by:
- writeBytesin interface- java.io.DataOutput
- Throws:
- java.io.IOException
 
 - 
writeCharpublic void writeChar(int v) throws java.io.IOException Writes a char as specified byDataOutputStream.writeChar(int), except using little-endian byte order.- Specified by:
- writeCharin interface- java.io.DataOutput
- Throws:
- java.io.IOException- if an I/O error occurs
 
 - 
writeCharspublic void writeChars(java.lang.String s) throws java.io.IOException Writes aStringas specified byDataOutputStream.writeChars(String), except each character is written using little-endian byte order.- Specified by:
- writeCharsin interface- java.io.DataOutput
- Throws:
- java.io.IOException- if an I/O error occurs
 
 - 
writeDoublepublic void writeDouble(double v) throws java.io.IOException Writes adoubleas specified byDataOutputStream.writeDouble(double), except using little-endian byte order.- Specified by:
- writeDoublein interface- java.io.DataOutput
- Throws:
- java.io.IOException- if an I/O error occurs
 
 - 
writeFloatpublic void writeFloat(float v) throws java.io.IOException Writes afloatas specified byDataOutputStream.writeFloat(float), except using little-endian byte order.- Specified by:
- writeFloatin interface- java.io.DataOutput
- Throws:
- java.io.IOException- if an I/O error occurs
 
 - 
writeIntpublic void writeInt(int v) throws java.io.IOException Writes anintas specified byDataOutputStream.writeInt(int), except using little-endian byte order.- Specified by:
- writeIntin interface- java.io.DataOutput
- Throws:
- java.io.IOException- if an I/O error occurs
 
 - 
writeLongpublic void writeLong(long v) throws java.io.IOException Writes alongas specified byDataOutputStream.writeLong(long), except using little-endian byte order.- Specified by:
- writeLongin interface- java.io.DataOutput
- Throws:
- java.io.IOException- if an I/O error occurs
 
 - 
writeShortpublic void writeShort(int v) throws java.io.IOException Writes ashortas specified byDataOutputStream.writeShort(int), except using little-endian byte order.- Specified by:
- writeShortin interface- java.io.DataOutput
- Throws:
- java.io.IOException- if an I/O error occurs
 
 - 
writeUTFpublic void writeUTF(java.lang.String str) throws java.io.IOException - Specified by:
- writeUTFin interface- java.io.DataOutput
- Throws:
- java.io.IOException
 
 - 
closepublic void close() throws java.io.IOException - Specified by:
- closein interface- java.lang.AutoCloseable
- Specified by:
- closein interface- java.io.Closeable
- Overrides:
- closein class- java.io.FilterOutputStream
- Throws:
- java.io.IOException
 
 
- 
 
-