public class UESStreamBuffer
extends java.io.OutputStream
OutputStream
used as pipe between OutputStream
and InputStream
. Streams are connected using buffer. If size of piped data
exceeds configured buffer size, temporary file is transparently used to store
buffered data.Modifier and Type | Class and Description |
---|---|
private class |
UESStreamBuffer.UESBufferFileInputStream
Special implementation of
FileInputStream which
removes file when close method is called. |
Modifier and Type | Field and Description |
---|---|
private int |
actualSize
Actual stored size.
|
private byte[] |
buffer
Memory buffer.
|
private java.io.File |
bufferFile
File buffer.
|
private java.io.InputStream |
bufferIn
File buffer input stream.
|
private java.io.OutputStream |
bufferOut
File buffer output stream.
|
private static int |
DEFAULT_BUFFER_SIZE
Default buffer size = 1MB.
|
Constructor and Description |
---|
UESStreamBuffer()
Creates new instance of UESStreamBuffer with default
buffer size of 1MB.
|
UESStreamBuffer(int size)
Creates new instance of UESStreamBuffer with given
buffer size (in bytes).
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Method clears buffer - input stream returned from method getInputStream is closed
and temporary buffer file is removed.
|
void |
close() |
void |
flush() |
private byte[] |
getBufferedData()
Get only actual data from buffer.
|
java.io.InputStream |
getInputStream()
Returns input stream for reading of buffered data.
|
void |
write(int b) |
size
- Buffer size in byteswrite
in class java.io.OutputStream
java.io.IOException
flush
in interface java.io.Flushable
flush
in class java.io.OutputStream
java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.OutputStream
java.io.IOException
UESIORTException
- In case input stream cannot be created