org.apache.fop.pdf

Interface StreamCache

Known Implementing Classes:
InMemoryStreamCache, TempFileStreamCache

public interface StreamCache

Interface used to store the bytes for a PDFStream. It's actually a generic cached byte array. There's a factory that returns either an in-memory or tempfile based implementation based on a cacheToFile setting.

Method Summary

void
clear()
Clears and resets the cache.
OutputStream
getOutputStream()
Get the current OutputStream.
int
getSize()
Returns the current size of the stream.
int
outputContents(OutputStream out)
Outputs the cached bytes to the given stream.
void
write(byte[] data)
Convenience method for writing data to the stream cache.

Method Details

clear

public void clear()
            throws IOException
Clears and resets the cache.

getOutputStream

public OutputStream getOutputStream()
            throws IOException
Get the current OutputStream. Do not store it - it may change from call to call.
Returns:
an output stream for this cache

getSize

public int getSize()
            throws IOException
Returns the current size of the stream.
Returns:
the size of the cache

outputContents

public int outputContents(OutputStream out)
            throws IOException
Outputs the cached bytes to the given stream.
Parameters:
out - the stream to write to
Returns:
the number of bytes written

write

public void write(byte[] data)
            throws IOException
Convenience method for writing data to the stream cache.
Parameters:
data - byte array to write

Copyright 1999-2008 The Apache Software Foundation. All Rights Reserved.