|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.archive.io.DiskByteQueue
public class DiskByteQueue
FIFO byte queue, using disk space as needed. TODO: add maximum size? Flips between two backing files: as soon as reading head reaches end of one, and is about to start at the front of the other, the writing tail flips to a new file. The current write-target file (tail) has a file extension ".qout", the current read file (head) has a file extension ".qin".
| Nested Class Summary | |
|---|---|
class |
DiskByteQueue.FlipFileInputStream
An input stream that supports the DiskBackedByteQueue, by always reading from the current inFile, and triggering a "flip" when one inFile is exhausted. |
(package private) class |
DiskByteQueue.FlipFileOutputStream
An output stream that supports the DiskBackedByteQueue, by always appending to the current outFile. |
| Field Summary | |
|---|---|
(package private) java.lang.String |
backingFilenamePrefix
|
(package private) DiskByteQueue.FlipFileInputStream |
headStream
|
(package private) java.io.File |
inFile
|
(package private) java.io.File |
outFile
|
(package private) long |
rememberedPosition
|
(package private) DiskByteQueue.FlipFileOutputStream |
tailStream
|
(package private) java.io.File |
tempDir
|
| Constructor Summary | |
|---|---|
DiskByteQueue(java.io.File tempDir,
java.lang.String backingFilenamePrefix,
boolean reuse)
Create a new BiskBackedByteQueue in the given directory with given filename prefix |
|
| Method Summary | |
|---|---|
void |
close()
|
void |
connect()
|
void |
discard()
frees all streams/files associated with this object |
void |
disconnect()
|
(package private) void |
flip()
flip the current outFile to the inFile role, make new outFile |
java.io.InputStream |
getHeadStream()
|
java.io.InputStream |
getReadAllInputStream()
Returns an input stream that covers the entire queue. |
java.io.OutputStream |
getTailStream()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
java.io.File tempDir
java.lang.String backingFilenamePrefix
java.io.File inFile
java.io.File outFile
transient DiskByteQueue.FlipFileInputStream headStream
long rememberedPosition
transient DiskByteQueue.FlipFileOutputStream tailStream
| Constructor Detail |
|---|
public DiskByteQueue(java.io.File tempDir,
java.lang.String backingFilenamePrefix,
boolean reuse)
tempDir - backingFilenamePrefix - reuse - whether to reuse any prexisting backing files| Method Detail |
|---|
public java.io.InputStream getHeadStream()
throws java.io.IOException
java.io.IOException
public java.io.OutputStream getTailStream()
throws java.io.FileNotFoundException
java.io.FileNotFoundException
void flip()
throws java.io.IOException
java.io.IOException
public java.io.InputStream getReadAllInputStream()
throws java.io.IOException
java.io.IOException
public void close()
throws java.io.IOException
java.io.IOException
public void discard()
throws java.io.IOException
java.io.IOException
public void disconnect()
throws java.io.IOException
java.io.IOException
public void connect()
throws java.io.IOException
java.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||