|
||||||||||
PREV CLASS (src) NEXT CLASS (src) | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.OutputStream
java.io.ObjectOutputStream
org.jboss.util.stream.ObjectOutputStreamAdapter (src)
org.jboss.util.stream.AutoResetObjectOutputStream
An ObjectOutputStream
that will auto reset after n
objects have been written to the underlying stream.
Nested Class Summary |
Nested classes inherited from class java.io.ObjectOutputStream |
java.io.ObjectOutputStream.PutField |
Field Summary | |
protected int |
after
Number of objects to write before resetting. |
protected int |
count
Number of objects written so far. |
Fields inherited from class org.jboss.util.stream.ObjectOutputStreamAdapter (src) |
out |
Fields inherited from interface java.io.ObjectStreamConstants |
baseWireHandle, PROTOCOL_VERSION_1, PROTOCOL_VERSION_2, SC_BLOCK_DATA, SC_EXTERNALIZABLE, SC_SERIALIZABLE, SC_WRITE_METHOD, STREAM_MAGIC, STREAM_VERSION, SUBCLASS_IMPLEMENTATION_PERMISSION, SUBSTITUTION_PERMISSION, TC_ARRAY, TC_BASE, TC_BLOCKDATA, TC_BLOCKDATALONG, TC_CLASS, TC_CLASSDESC, TC_ENDBLOCKDATA, TC_EXCEPTION, TC_LONGSTRING, TC_MAX, TC_NULL, TC_OBJECT, TC_PROXYCLASSDESC, TC_REFERENCE, TC_RESET, TC_STRING |
Constructor Summary | |
AutoResetObjectOutputStream(java.io.ObjectOutputStream out,
int after)
Construct a new AutoResetObjectOutputStream. |
Method Summary | |
int |
getCount()
Get the number of objects written to the stream so far. |
int |
getResetAfter()
Get the number of objects that must be written before resetting the stream. |
void |
reset()
Resets the object counter as well as the nested stream. |
void |
setResetAfter(int after)
Set the number of objects that must be written before resetting the stream. |
protected void |
writeObjectOverride(java.lang.Object obj)
Write the given object and reset if the number of objects written (including this one) exceeds the after count. |
Methods inherited from class org.jboss.util.stream.ObjectOutputStreamAdapter (src) |
close, defaultWriteObject, flush, putFields, useProtocolVersion, write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFields, writeFloat, writeInt, writeLong, writeShort, writeUTF |
Methods inherited from class java.io.ObjectOutputStream |
annotateClass, annotateProxyClass, drain, enableReplaceObject, replaceObject, writeClassDescriptor, writeObject, writeStreamHeader, writeUnshared |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected int after
protected int count
Constructor Detail |
public AutoResetObjectOutputStream(java.io.ObjectOutputStream out, int after) throws java.io.IOException
out
- An ObjectOutputStream stream.after
- Number of objects to write before resetting.
java.lang.IllegalArgumentException
- After <= 0
java.io.IOException
- Any exception thrown by
the underlying OutputStream.Method Detail |
public void setResetAfter(int after)
after
- Number of objects to write before resetting.
java.lang.IllegalArgumentException
- After <= 0public final int getResetAfter()
public final int getCount()
protected void writeObjectOverride(java.lang.Object obj) throws java.io.IOException
writeObjectOverride
in class ObjectOutputStreamAdapter (src)
obj
- Object to write.
java.io.IOException
- Any exception thrown by the underlying stream.public void reset() throws java.io.IOException
reset
in class ObjectOutputStreamAdapter (src)
java.io.IOException
|
||||||||||
PREV CLASS (src) NEXT CLASS (src) | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |