Class MemCheckpointStreamFactory.MemoryCheckpointOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.apache.flink.core.fs.FSDataOutputStream
-
- org.apache.flink.runtime.state.CheckpointStateOutputStream
-
- org.apache.flink.runtime.state.memory.MemCheckpointStreamFactory.MemoryCheckpointOutputStream
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
- Enclosing class:
- MemCheckpointStreamFactory
public static class MemCheckpointStreamFactory.MemoryCheckpointOutputStream extends CheckpointStateOutputStream
ACheckpointStateOutputStreamthat writes into a byte array.
-
-
Constructor Summary
Constructors Constructor Description MemoryCheckpointOutputStream(int maxSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()This method should close the stream, if has not been closed before.byte[]closeAndGetBytes()Closes the stream and returns the byte array containing the stream's data.StreamStateHandlecloseAndGetHandle()Closes the stream and gets a state handle that can create an input stream producing the data written to this stream.voidflush()longgetPos()booleanisClosed()voidsync()voidwrite(byte[] b, int off, int len)voidwrite(int b)-
Methods inherited from class java.io.OutputStream
nullOutputStream, write
-
-
-
-
Method Detail
-
write
public void write(int b) throws IOException- Specified by:
writein classOutputStream- Throws:
IOException
-
write
public void write(byte[] b, int off, int len) throws IOException- Overrides:
writein classOutputStream- Throws:
IOException
-
flush
public void flush() throws IOException- Specified by:
flushin interfaceFlushable- Specified by:
flushin classorg.apache.flink.core.fs.FSDataOutputStream- Throws:
IOException
-
sync
public void sync() throws IOException- Specified by:
syncin classorg.apache.flink.core.fs.FSDataOutputStream- Throws:
IOException
-
close
public void close()
Description copied from class:CheckpointStateOutputStreamThis method should close the stream, if has not been closed before. If this method actually closes the stream, it should delete/release the resource behind the stream, such as the file that the stream writes to.The above implies that this method is intended to be the "unsuccessful close", such as when cancelling the stream writing, or when an exception occurs. Closing the stream for the successful case must go through
CheckpointStateOutputStream.closeAndGetHandle().- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classCheckpointStateOutputStream
-
closeAndGetHandle
@Nullable public StreamStateHandle closeAndGetHandle() throws IOException
Description copied from class:CheckpointStateOutputStreamCloses the stream and gets a state handle that can create an input stream producing the data written to this stream.This closing must be called (also when the caller is not interested in the handle) to successfully close the stream and retain the produced resource. In contrast, the
CheckpointStateOutputStream.close()method removes the target resource when called.- Specified by:
closeAndGetHandlein classCheckpointStateOutputStream- Returns:
- A state handle that can create an input stream producing the data written to this stream.
- Throws:
IOException- Thrown, if the stream cannot be closed.
-
getPos
public long getPos() throws IOException- Specified by:
getPosin classorg.apache.flink.core.fs.FSDataOutputStream- Throws:
IOException
-
isClosed
public boolean isClosed()
-
closeAndGetBytes
public byte[] closeAndGetBytes() throws IOExceptionCloses the stream and returns the byte array containing the stream's data.- Returns:
- The byte array containing the stream's data.
- Throws:
IOException- Thrown if the size of the data exceeds the maximal
-
-