|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.OutputStream
to.etc.util.FileBackedBuffer
public class FileBackedBuffer
A buffer which accepts data and buffers it. The data can be obtained again by reading an input stream. If the data grows too large (user definable) it can flush the data into a tempfile. This class is not threadsafe of course.
Because this class may retain a file it is important that it gets cleaned up after use by calling discard().
Constructor Summary | |
---|---|
FileBackedBuffer()
|
|
FileBackedBuffer(int size)
|
|
FileBackedBuffer(int size,
int initial)
|
Method Summary | |
---|---|
void |
clear()
Removes all contents from this thingy, and reopens it as an output stream. |
void |
close()
This closes the write channel. |
void |
copy(java.io.OutputStream os)
Sends all of the contained data to the outputstream. |
void |
discard()
This MUST be called after use. |
protected void |
finalize()
This finalizer at least tries to cleanup the mess if discard() was not called... |
java.io.InputStream |
getInputStream()
Returns an inputstream which reads this. |
int |
size()
|
void |
write(byte[] b,
int off,
int len)
|
void |
write(int b)
|
Methods inherited from class java.io.OutputStream |
---|
flush, write |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FileBackedBuffer()
public FileBackedBuffer(int size)
public FileBackedBuffer(int size, int initial)
Method Detail |
---|
public void discard()
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
Object.finalize()
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in class java.io.OutputStream
java.io.IOException
OutputStream.close()
public void write(byte[] b, int off, int len) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public void write(int b) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public void clear()
public java.io.InputStream getInputStream() throws java.io.IOException
java.io.IOException
public int size()
public void copy(java.io.OutputStream os) throws java.io.IOException
os
-
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |