gov.nasa.gsfc.drl.rtstps.clients.spooler
Class FileSpool
java.lang.Object
gov.nasa.gsfc.drl.rtstps.clients.spooler.FileSpool
final class FileSpool
- extends java.lang.Object
A file fifo.
Constructor Summary |
FileSpool(int maxBlocks,
java.io.File tempFileDirectory)
Create a FileSpool. |
Method Summary |
(package private) void |
closeReader()
|
(package private) void |
closeWriter()
|
(package private) byte[] |
getWriteBuffer()
Get a buffer to be used for writing to the spool. |
(package private) boolean |
putWriteBuffer(int length,
boolean toggle)
Put the write-buffer into the spool. |
(package private) Block |
read()
Read the next block from the temporary file. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
maxBlocks
private int maxBlocks
keyList
private FileSpool.KeyList keyList
writer
private FileSpool.FWriter writer
reader
private FileSpool.FReader reader
file
private java.io.File file
FileSpool
FileSpool(int maxBlocks,
java.io.File tempFileDirectory)
throws java.io.IOException
- Create a FileSpool.
- Parameters:
maxBlocks
- The "fall behind" threshold. The writer is
signalled if the reader falls behind by more than this
number of blocks.tempFileDirectory
- Where the file resides. If null, it
uses the system default temp directory.
- Throws:
java.io.IOException
getWriteBuffer
final byte[] getWriteBuffer()
- Get a buffer to be used for writing to the spool.
putWriteBuffer
boolean putWriteBuffer(int length,
boolean toggle)
throws java.io.IOException
- Put the write-buffer into the spool.
- Parameters:
length
- the true buffer length, which may be less than its
allocated block length.toggle
- If true, the reader should switch to the pipe after
processing this block.
- Returns:
- true if the reader has fallen so far behind that the
maximum block quota has been exceeded.
- Throws:
java.io.IOException
read
final Block read()
throws java.io.IOException
- Read the next block from the temporary file.
- Returns:
- null if no block is available.
- Throws:
java.io.IOException
closeWriter
void closeWriter()
throws java.io.IOException
- Throws:
java.io.IOException
closeReader
void closeReader()
throws java.io.IOException
- Throws:
java.io.IOException