Package alluxio.underfs.hdfs
Class HdfsUnderFileOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- alluxio.underfs.hdfs.HdfsUnderFileOutputStream
-
- All Implemented Interfaces:
alluxio.underfs.ContentHashable
,java.io.Closeable
,java.io.Flushable
,java.lang.AutoCloseable
@NotThreadSafe public class HdfsUnderFileOutputStream extends java.io.OutputStream implements alluxio.underfs.ContentHashable
Output stream implementation forHdfsUnderFileSystem
. This class is just a wrapper on top of an underlyingFSDataOutputStream
, except all calls toflush()
will be converted toFSDataOutputStream#sync()
. This is currently safe because all invocations of flush intend the functionality to be sync.
-
-
Constructor Summary
Constructors Constructor Description HdfsUnderFileOutputStream(org.apache.hadoop.fs.FileSystem fs, java.lang.String path, org.apache.hadoop.fs.FSDataOutputStream out)
Basic constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
flush()
java.util.Optional<java.lang.String>
getContentHash()
void
write(byte[] b)
void
write(byte[] b, int off, int len)
void
write(int b)
-
-
-
Constructor Detail
-
HdfsUnderFileOutputStream
public HdfsUnderFileOutputStream(org.apache.hadoop.fs.FileSystem fs, java.lang.String path, org.apache.hadoop.fs.FSDataOutputStream out)
Basic constructor.- Parameters:
fs
- the hdfs file system objectpath
- the path being writtenout
- underlying stream to wrap
-
-
Method Detail
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOException
- Specified by:
flush
in interfacejava.io.Flushable
- Overrides:
flush
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
write
public void write(int b) throws java.io.IOException
- Specified by:
write
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
write
public void write(byte[] b) throws java.io.IOException
- Overrides:
write
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
write
public void write(byte[] b, int off, int len) throws java.io.IOException
- Overrides:
write
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
getContentHash
public java.util.Optional<java.lang.String> getContentHash() throws java.io.IOException
- Specified by:
getContentHash
in interfacealluxio.underfs.ContentHashable
- Throws:
java.io.IOException
-
-