Package alluxio.underfs.gcs.v2
Class GCSV2OutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- alluxio.underfs.gcs.v2.GCSV2OutputStream
-
- All Implemented Interfaces:
alluxio.underfs.ContentHashable,java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable
@NotThreadSafe public final class GCSV2OutputStream extends java.io.OutputStream implements alluxio.underfs.ContentHashableA stream for writing a file into GCS using Google cloud API (GCS output stream version 2). The data is streaming writing to GCS without waiting for the complete file to arrive in Alluxio worker.
-
-
Constructor Summary
Constructors Constructor Description GCSV2OutputStream(java.lang.String bucketName, java.lang.String key, com.google.cloud.storage.Storage client)Constructs a new stream for writing a file.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidflush()java.util.Optional<java.lang.String>getContentHash()voidwrite(byte[] b)voidwrite(byte[] b, int off, int len)voidwrite(int b)
-
-
-
Constructor Detail
-
GCSV2OutputStream
public GCSV2OutputStream(java.lang.String bucketName, java.lang.String key, com.google.cloud.storage.Storage client)Constructs a new stream for writing a file.- Parameters:
bucketName- the name of the bucketkey- the key of the fileclient- the Google cloud storage client
-
-
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() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.OutputStream- Throws:
java.io.IOException
-
getContentHash
public java.util.Optional<java.lang.String> getContentHash()
- Specified by:
getContentHashin interfacealluxio.underfs.ContentHashable
-
-