Class ObjectEncoderOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.jboss.netty.handler.codec.serialization.ObjectEncoderOutputStream
-
- All Implemented Interfaces:
Closeable
,DataOutput
,Flushable
,ObjectOutput
,AutoCloseable
public class ObjectEncoderOutputStream extends OutputStream implements ObjectOutput
-
-
Constructor Summary
Constructors Constructor Description ObjectEncoderOutputStream(OutputStream out)
Creates a newObjectOutput
with the estimated length of 512 bytes.ObjectEncoderOutputStream(OutputStream out, int estimatedLength)
Creates a newObjectOutput
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
flush()
int
size()
void
write(byte[] b)
void
write(byte[] b, int off, int len)
void
write(int b)
void
writeBoolean(boolean v)
void
writeByte(int v)
void
writeBytes(String s)
void
writeChar(int v)
void
writeChars(String s)
void
writeDouble(double v)
void
writeFloat(float v)
void
writeInt(int v)
void
writeLong(long v)
void
writeObject(Object obj)
void
writeShort(int v)
void
writeUTF(String str)
-
-
-
Constructor Detail
-
ObjectEncoderOutputStream
public ObjectEncoderOutputStream(OutputStream out)
Creates a newObjectOutput
with the estimated length of 512 bytes.- Parameters:
out
- theOutputStream
where the serialized form will be written out
-
ObjectEncoderOutputStream
public ObjectEncoderOutputStream(OutputStream out, int estimatedLength)
Creates a newObjectOutput
.- Parameters:
out
- theOutputStream
where the serialized form will be written outestimatedLength
- the estimated byte length of the serialized form of an object. If the length of the serialized form exceeds this value, the internal buffer will be expanded automatically at the cost of memory bandwidth. If this value is too big, it will also waste memory bandwidth. To avoid unnecessary memory copy or allocation cost, please specify the properly estimated value.
-
-
Method Detail
-
writeObject
public void writeObject(Object obj) throws IOException
- Specified by:
writeObject
in interfaceObjectOutput
- Throws:
IOException
-
write
public void write(int b) throws IOException
- Specified by:
write
in interfaceDataOutput
- Specified by:
write
in interfaceObjectOutput
- Specified by:
write
in classOutputStream
- Throws:
IOException
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceObjectOutput
- Overrides:
close
in classOutputStream
- Throws:
IOException
-
flush
public void flush() throws IOException
- Specified by:
flush
in interfaceFlushable
- Specified by:
flush
in interfaceObjectOutput
- Overrides:
flush
in classOutputStream
- Throws:
IOException
-
size
public final int size()
-
write
public void write(byte[] b, int off, int len) throws IOException
- Specified by:
write
in interfaceDataOutput
- Specified by:
write
in interfaceObjectOutput
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
write
public void write(byte[] b) throws IOException
- Specified by:
write
in interfaceDataOutput
- Specified by:
write
in interfaceObjectOutput
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
writeBoolean
public final void writeBoolean(boolean v) throws IOException
- Specified by:
writeBoolean
in interfaceDataOutput
- Throws:
IOException
-
writeByte
public final void writeByte(int v) throws IOException
- Specified by:
writeByte
in interfaceDataOutput
- Throws:
IOException
-
writeBytes
public final void writeBytes(String s) throws IOException
- Specified by:
writeBytes
in interfaceDataOutput
- Throws:
IOException
-
writeChar
public final void writeChar(int v) throws IOException
- Specified by:
writeChar
in interfaceDataOutput
- Throws:
IOException
-
writeChars
public final void writeChars(String s) throws IOException
- Specified by:
writeChars
in interfaceDataOutput
- Throws:
IOException
-
writeDouble
public final void writeDouble(double v) throws IOException
- Specified by:
writeDouble
in interfaceDataOutput
- Throws:
IOException
-
writeFloat
public final void writeFloat(float v) throws IOException
- Specified by:
writeFloat
in interfaceDataOutput
- Throws:
IOException
-
writeInt
public final void writeInt(int v) throws IOException
- Specified by:
writeInt
in interfaceDataOutput
- Throws:
IOException
-
writeLong
public final void writeLong(long v) throws IOException
- Specified by:
writeLong
in interfaceDataOutput
- Throws:
IOException
-
writeShort
public final void writeShort(int v) throws IOException
- Specified by:
writeShort
in interfaceDataOutput
- Throws:
IOException
-
writeUTF
public final void writeUTF(String str) throws IOException
- Specified by:
writeUTF
in interfaceDataOutput
- Throws:
IOException
-
-