Package org.apache.fop.pdf
Class InMemoryStreamCache
java.lang.Object
org.apache.fop.pdf.InMemoryStreamCache
- All Implemented Interfaces:
StreamCache
StreamCache implementation that uses temporary files rather than heap.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new InMemoryStreamCache.InMemoryStreamCache
(int hintSize) Creates a new InMemoryStreamCache. -
Method Summary
-
Constructor Details
-
InMemoryStreamCache
public InMemoryStreamCache()Creates a new InMemoryStreamCache. -
InMemoryStreamCache
public InMemoryStreamCache(int hintSize) Creates a new InMemoryStreamCache.- Parameters:
hintSize
- a hint about the approximate expected size of the buffer
-
-
Method Details
-
getOutputStream
Get the current OutputStream. Do not store it - it may change from call to call.- Specified by:
getOutputStream
in interfaceStreamCache
- Returns:
- the output stream containing the data
- Throws:
IOException
- if there is an error getting the output stream
-
write
Convenience method for writing data to the stream cache.- Specified by:
write
in interfaceStreamCache
- Parameters:
data
- byte array to write- Throws:
IOException
- if there is an IO error
-
outputContents
Outputs the cached bytes to the given stream.- Specified by:
outputContents
in interfaceStreamCache
- Parameters:
out
- the output stream to write to- Returns:
- the number of bytes written
- Throws:
IOException
- if there is an IO error writing to the output stream
-
getSize
Returns the current size of the stream.- Specified by:
getSize
in interfaceStreamCache
- Returns:
- the length of the stream
- Throws:
IOException
- if there is an error getting the size
-
clear
Clears and resets the cache.- Specified by:
clear
in interfaceStreamCache
- Throws:
IOException
- if there is an error closing the stream
-