Package alluxio.underfs.kodo
Class KodoOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- alluxio.underfs.kodo.KodoOutputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable
@NotThreadSafe public class KodoOutputStream extends java.io.OutputStreamA stream for writing a file into Qiniu. The data will be persisted to a temporary directory on the local disk and copied as a complete file when theclose()method is called.
-
-
Constructor Summary
Constructors Constructor Description KodoOutputStream(java.lang.String key, KodoClient kodoClient, java.util.List<java.lang.String> tmpDirs)Creates a name instance ofKodoOutputStream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes this output stream.voidflush()voidwrite(byte[] b)voidwrite(byte[] b, int off, int len)voidwrite(int b)
-
-
-
Constructor Detail
-
KodoOutputStream
public KodoOutputStream(java.lang.String key, KodoClient kodoClient, java.util.List<java.lang.String> tmpDirs) throws java.io.IOExceptionCreates a name instance ofKodoOutputStream.- Parameters:
key- the key of the filekodoClient- the client for KodotmpDirs- a list of temporary directories- Throws:
java.io.IOException
-
-
Method Detail
-
write
public void write(int b) throws java.io.IOException- Specified by:
writein classjava.io.OutputStream- Throws:
java.io.IOException
-
write
public void write(byte[] b) throws java.io.IOException- Overrides:
writein classjava.io.OutputStream- Throws:
java.io.IOException
-
write
public void write(byte[] b, int off, int len) throws java.io.IOException- Overrides:
writein classjava.io.OutputStream- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOException- Specified by:
flushin interfacejava.io.Flushable- Overrides:
flushin classjava.io.OutputStream- Throws:
java.io.IOException
-
close
public void close()
Closes this output stream. When an output stream is closed, the local temporary file is uploaded to KODO Service. Once the file is uploaded, the temporary file is deleted.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.OutputStream
-
-