|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.OutputStream
org.deegree.commons.utils.io.StreamBufferStore
public class StreamBufferStore
Scalable alternative to ByteArrayOutputStream
that automatically switches to file storage if the amount of
written output exceeds a given limit.
Field Summary | |
---|---|
static int |
DEFAULT_LIMIT
Default limit |
Constructor Summary | |
---|---|
StreamBufferStore()
Creates a new StreamBufferStore instance that switches to file storage when
DEFAULT_LIMIT bytes have been written. |
|
StreamBufferStore(int limit)
Creates a new StreamBufferStore instance that switches to file storage when the specified number of bytes
have been written. |
Method Summary | |
---|---|
void |
close()
|
void |
flush()
|
java.io.InputStream |
getInputStream()
Returns an InputStream for accessing the previously written bytes. |
void |
reset()
Clears any data that exists in the buffer. |
int |
size()
Returns the current size of the buffer. |
void |
write(byte[] b)
|
void |
write(byte[] b,
int off,
int len)
|
void |
write(int b)
|
void |
writeTo(java.io.OutputStream outputStream)
Writes the complete contents of this buffer to the specified output stream argument, as if by calling the output stream's write method using out.write(buf, 0, count) . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_LIMIT
Constructor Detail |
---|
public StreamBufferStore()
StreamBufferStore
instance that switches to file storage when
DEFAULT_LIMIT
bytes have been written.
public StreamBufferStore(int limit)
StreamBufferStore
instance that switches to file storage when the specified number of bytes
have been written.
limit
- number of bytes when switching to file will occurMethod Detail |
---|
public int size()
public java.io.InputStream getInputStream() throws java.io.IOException
InputStream
for accessing the previously written bytes.
InputStream
, never null
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in class java.io.OutputStream
java.io.IOException
public void flush() throws java.io.IOException
flush
in interface java.io.Flushable
flush
in class java.io.OutputStream
java.io.IOException
public void write(byte[] b) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
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 writeTo(java.io.OutputStream outputStream) throws java.io.IOException
out.write(buf, 0, count)
.
outputStream
- stream to write to, must not be null
java.io.IOException
- if an I/O error occurspublic void reset()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |