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
null
if 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:
write
in classOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
flush
- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
-