Class OperatorOutputStream
java.lang.Object
java.io.OutputStream
org.apache.opendal.OperatorOutputStream
- All Implemented Interfaces:
Closeable, Flushable, AutoCloseable
-
Constructor Summary
ConstructorsConstructorDescriptionOperatorOutputStream(Operator operator, String path, int maxBytes, WriteOptions options) Creates a stream with the given buffer size and maximum native write size.OperatorOutputStream(Operator operator, String path, WriteOptions options) -
Method Summary
Methods inherited from class OutputStream
nullOutputStream, write
-
Constructor Details
-
OperatorOutputStream
-
OperatorOutputStream
Creates a stream with the given buffer size and maximum native write size.- Throws:
IllegalArgumentException- if maxBytes is not positive
-
-
Method Details
-
write
- Specified by:
writein classOutputStream- Throws:
IOException
-
write
- Overrides:
writein classOutputStream- Throws:
IOException
-
flush
public void flush()- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream
-
abort
public void abort()Discards buffered bytes and asks the backend to clean up the unfinished write.Call this before
close()to abandon an upload, for example when reading the source fails. Cleanup depends on the backend. Data already visible may remain, and a previous object may not be restored.This releases the native writer even if cleanup fails. Subsequent writes and flushes throw
IllegalStateException. Subsequent calls toabort()orclose()do nothing.- Throws:
OpenDALException- if backend cleanup fails or is unsupported
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream
-