|
||||||||||
| PREV CLASS NEXT CLASS | 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
org.jboss.util.stream.AutoResetObjectOutputStream
public class AutoResetObjectOutputStream
An ObjectOutputStream that will auto reset after n
objects have been written to the underlying stream.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.io.ObjectOutputStream |
|---|
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 |
|---|
out |
| Constructor Summary | |
|---|---|
AutoResetObjectOutputStream(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(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 |
|---|
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(ObjectOutputStream out,
int after)
throws IOException
out - An ObjectOutputStream stream.after - Number of objects to write before resetting.
IllegalArgumentException - After <= 0
IOException - Any exception thrown by
the underlying OutputStream.| Method Detail |
|---|
public void setResetAfter(int after)
after - Number of objects to write before resetting.
IllegalArgumentException - After <= 0public final int getResetAfter()
public final int getCount()
protected void writeObjectOverride(Object obj)
throws IOException
writeObjectOverride in class ObjectOutputStreamAdapterobj - Object to write.
IOException - Any exception thrown by the underlying stream.
public void reset()
throws IOException
reset in class ObjectOutputStreamAdapterIOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||