javolution37.javolution.xml
Class XmlOutputStream<T>
- java.lang.Object
-
- java.io.OutputStream
-
- javolution37.javolution.xml.XmlOutputStream<T>
-
- All Implemented Interfaces:
- java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable, Reusable
public class XmlOutputStream<T> extends java.io.OutputStream implements Reusable
This class represents an object output stream using
ObjectWriterfor object serialization.Instances of this class embed their own data buffer, wrapping using a
java.io.BufferedOutputStreamis therefore unnescessary.- See Also:
XmlInputStream
-
-
Constructor Summary
Constructors Constructor and Description XmlOutputStream()Default constructor.XmlOutputStream(ObjectWriter<T> writer)Creates a xml output stream using the specified object writer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidclose()Closes andresetsthis stream for reuse.voidflush()Flushes this output stream and forces any buffered output bytes to be written out.voidreset()Resets the internal state of this object to its default values.XmlOutputStreamsetOutputStream(java.io.OutputStream out)Sets the underlying output destination for this stream.voidwrite(byte[] b, int off, int len)Writes the specified number of bytes from the specified byte array starting at the specified offset to this output stream.voidwrite(int b)Writes the specified byte to this output streamvoidwriteObject(T obj)Writes an object to the underlying stream using anObjectWriter.
-
-
-
Constructor Detail
-
XmlOutputStream
public XmlOutputStream()
Default constructor.
-
XmlOutputStream
public XmlOutputStream(ObjectWriter<T> writer)
Creates a xml output stream using the specified object writer.- Parameters:
writer- the object writer.
-
-
Method Detail
-
setOutputStream
public XmlOutputStream setOutputStream(java.io.OutputStream out)
Sets the underlying output destination for this stream.
-
writeObject
public void writeObject(T obj) throws java.io.IOException
Writes an object to the underlying stream using anObjectWriter.- Parameters:
obj- the object writen using its xml representation.- Throws:
java.io.IOException- if an I/O error occurs.
-
write
public void write(int b) throws java.io.IOExceptionWrites the specified byte to this output stream- Specified by:
writein classjava.io.OutputStream- Parameters:
b- the byte.- Throws:
java.io.IOException- if an I/O error occurs.
-
flush
public void flush() throws java.io.IOExceptionFlushes this output stream and forces any buffered output bytes to be written out.- Specified by:
flushin interfacejava.io.Flushable- Overrides:
flushin classjava.io.OutputStream- Throws:
java.io.IOException- if an I/O error occurs.
-
write
public void write(byte[] b, int off, int len) throws java.io.IOExceptionWrites the specified number of bytes from the specified byte array starting at the specified offset to this output stream.- Overrides:
writein classjava.io.OutputStream- Parameters:
b- the data.off- the start offset in the data.len- the number of bytes to write.- Throws:
java.io.IOException- if an I/O error occurs.
-
close
public void close() throws java.io.IOExceptionCloses andresetsthis stream for reuse.- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein interfacejava.lang.AutoCloseable- Overrides:
closein classjava.io.OutputStream- Throws:
java.io.IOException- if an I/O error occurs.
-
-
DMelt 3.0 © DataMelt by jWork.ORG