Package org.opendaylight.raft.spi
Class BufThenFileOutputStream
java.lang.Object
java.io.OutputStream
org.opendaylight.raft.spi.BufThenFileOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
An
OutputStream which stats off writing to a ByteBuf, but switches to a file.-
Constructor Summary
ConstructorsConstructorDescriptionBufThenFileOutputStream(Path directory, ByteBuf buf, int threshold) Default constructor. -
Method Summary
Methods inherited from class java.io.OutputStream
nullOutputStream, write
-
Constructor Details
-
BufThenFileOutputStream
Default constructor.- Parameters:
directory- the directory where to create temporary filesbuf- the output bufferthreshold- the cutover threshold
-
-
Method Details
-
file
Returns the file created for this object.- Returns:
- the file, or
nullif the output is below threshold
-
size
public long size()Returns the number of bytes output in this stream.- Returns:
- the number of bytes
-
write
- Specified by:
writein classOutputStream- Throws:
IOException
-
write
- Overrides:
writein classOutputStream- Throws:
IOException
-
flush
- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-