Reusable Java library of general tools with minimal external dependencies.
For questions or support, please contact us:
Email: support@aoindustries.com
Phone: 1-800-519-9541
Phone: +1-251-607-9556
Web: https://www.aoindustries.com/contact
public class FifoFile extends Object
FifoFile allows code to read and write to an on-disk managed FIFO.
Objects of this class provide InputStream and OutputStream
implementations that may be used by any number of concurrent threads. If using this
class to access a single file from multiple instances of FifoFile, whether
in a single JVM or different JVMs, due to limitations of the underlying
RandomAccessFile, only one instance may read and one instance may write.
However, race conditions still exists in this scenario, and it is strongly advised
to access a file through a single instance of FifoFile.
This class is best used for persistence or management of large FIFO data sets.
| Constructor and Description |
|---|
FifoFile(File file,
long maxFifoLength) |
FifoFile(String filename,
long maxFifoLength) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
int |
getBlockSize() |
long |
getFileLength() |
protected long |
getFirstIndex()
Gets the data index of the next value that will be read.
|
FifoFileInputStream |
getInputStream() |
long |
getLength()
Gets the number of bytes currently contained by the FIFO.
|
long |
getMaximumFifoLength() |
FifoFileOutputStream |
getOutputStream() |
void |
reset()
Resets this
FifoFile to contain no contents and start writing at the beginning of the file. |
protected void |
setFirstIndex(long index)
Sets the data index of the next value that will be read.
|
protected void |
setLength(long length)
Sets the number of bytes currently contained by the FIFO.
|
public FifoFile(String filename, long maxFifoLength) throws IOException
IOExceptionpublic FifoFile(File file, long maxFifoLength) throws IOException
IOExceptionpublic FifoFileInputStream getInputStream()
public FifoFileOutputStream getOutputStream()
public long getMaximumFifoLength()
public long getFileLength()
public int getBlockSize()
public void reset()
throws IOException
FifoFile to contain no contents and start writing at the beginning of the file.IOExceptionpublic void close()
throws IOException
IOExceptionprotected long getFirstIndex()
throws IOException
IOExceptionprotected void setFirstIndex(long index)
throws IOException
IOExceptionpublic long getLength()
throws IOException
IOExceptionprotected void setLength(long length)
throws IOException
IOExceptionCopyright © 2000–2016 AO Industries, Inc.. All rights reserved.