Package net.sf.jasperreports.engine.util
Class FileBufferedOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- net.sf.jasperreports.engine.util.FileBufferedOutputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.Flushable
,java.lang.AutoCloseable
public class FileBufferedOutputStream extends java.io.OutputStream
- Author:
- Lucian Chirita (lucianc@users.sourceforge.net)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
FileBufferedOutputStream.DataStream
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_INITIAL_MEMORY_BUFFER_SIZE
static int
DEFAULT_INPUT_BUFFER_LENGTH
static java.lang.String
EXCEPTION_MESSAGE_KEY_OUTPUT_STREAM_ALREADY_CLOSED
static int
INFINIT_MEMORY_THRESHOLD
static java.lang.String
PROPERTY_MEMORY_THRESHOLD
Specifies the maximum in-memory buffer length that triggers the creation of a temporary file on disk to store further content sent to this output stream.
-
Constructor Summary
Constructors Constructor Description FileBufferedOutputStream()
FileBufferedOutputStream(int memoryThreshold)
FileBufferedOutputStream(int memoryThreshold, int initialMemoryBufferSize)
FileBufferedOutputStream(int memoryThreshold, int initialMemoryBufferSize, int inputBufferLength)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int
availableMemorySpace()
void
checkClosed()
void
close()
void
dispose()
protected java.io.BufferedOutputStream
ensureFileOutput()
protected void
finalize()
void
flush()
java.io.InputStream
getDataInputStream()
int
size()
void
write(byte[] b, int off, int len)
void
write(int b)
void
writeData(java.io.OutputStream out)
-
-
-
Field Detail
-
EXCEPTION_MESSAGE_KEY_OUTPUT_STREAM_ALREADY_CLOSED
public static final java.lang.String EXCEPTION_MESSAGE_KEY_OUTPUT_STREAM_ALREADY_CLOSED
- See Also:
- Constant Field Values
-
PROPERTY_MEMORY_THRESHOLD
public static final java.lang.String PROPERTY_MEMORY_THRESHOLD
Specifies the maximum in-memory buffer length that triggers the creation of a temporary file on disk to store further content sent to this output stream.- See Also:
- Constant Field Values
-
INFINIT_MEMORY_THRESHOLD
public static final int INFINIT_MEMORY_THRESHOLD
- See Also:
- Constant Field Values
-
DEFAULT_INITIAL_MEMORY_BUFFER_SIZE
public static final int DEFAULT_INITIAL_MEMORY_BUFFER_SIZE
- See Also:
- Constant Field Values
-
DEFAULT_INPUT_BUFFER_LENGTH
public static final int DEFAULT_INPUT_BUFFER_LENGTH
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
FileBufferedOutputStream
public FileBufferedOutputStream()
-
FileBufferedOutputStream
public FileBufferedOutputStream(int memoryThreshold)
-
FileBufferedOutputStream
public FileBufferedOutputStream(int memoryThreshold, int initialMemoryBufferSize)
-
FileBufferedOutputStream
public FileBufferedOutputStream(int memoryThreshold, int initialMemoryBufferSize, int inputBufferLength)
-
-
Method Detail
-
write
public void write(int b) throws java.io.IOException
- Specified by:
write
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
availableMemorySpace
protected int availableMemorySpace()
-
ensureFileOutput
protected java.io.BufferedOutputStream ensureFileOutput() throws java.io.IOException, java.io.FileNotFoundException
- Throws:
java.io.IOException
java.io.FileNotFoundException
-
write
public void write(byte[] b, int off, int len) throws java.io.IOException
- Overrides:
write
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
checkClosed
public void checkClosed()
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOException
- Specified by:
flush
in interfacejava.io.Flushable
- Overrides:
flush
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
size
public int size()
-
writeData
public void writeData(java.io.OutputStream out) throws java.io.IOException
- Throws:
java.io.IOException
-
dispose
public void dispose()
-
finalize
protected void finalize() throws java.lang.Throwable
- Overrides:
finalize
in classjava.lang.Object
- Throws:
java.lang.Throwable
-
getDataInputStream
public java.io.InputStream getDataInputStream() throws java.io.IOException
- Throws:
java.io.IOException
-
-