Package io.pravega.client.segment.impl
Interface ConditionalOutputStream
-
- All Superinterfaces:
java.lang.AutoCloseable
public interface ConditionalOutputStream extends java.lang.AutoCloseableDefines a ConditionalOutputStream for a segment. Allows data to be conditionally appended to the end of the segment
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()Flushes and then closes the output stream.java.lang.StringgetScopedSegmentName()Returns the scoped name of the segment associated to this output stream.booleanwrite(java.nio.ByteBuffer data, long expectedOffset)Writes the provided data to the SegmentOutputStream.
-
-
-
Method Detail
-
getScopedSegmentName
java.lang.String getScopedSegmentName()
Returns the scoped name of the segment associated to this output stream.- Returns:
- The name of the segment associated to this output stream.
-
write
boolean write(java.nio.ByteBuffer data, long expectedOffset) throws SegmentSealedExceptionWrites the provided data to the SegmentOutputStream. The data will be written only if the SegmentOutputStream's writeOffset is currently expectedOffset. This is a synchronous and blocking method.- Parameters:
data- The data to be added to the segment.expectedOffset- The location in the segment that the data will be written at.- Returns:
- true if the data was appended, false if the offset was not the expected value.
- Throws:
SegmentSealedException- If the segment is closed for modifications.
-
close
void close()
Flushes and then closes the output stream. Frees any resources associated with it.- Specified by:
closein interfacejava.lang.AutoCloseable
-
-