@InterfaceAudience.Public @InterfaceStability.Evolving public abstract class FSDataOutputStreamBuilder<S extends FSDataOutputStream,B extends FSDataOutputStreamBuilder<S,B>> extends Object
FSDataOutputStream
and its subclasses.
It is used to create FSDataOutputStream
when creating a new file or
appending an existing file on FileSystem
.
By default, it does not create parent directory that do not exist.
FileSystem.createNonRecursive(Path, boolean, int, short, long,
Progressable)
.
To create missing parent directory, use recursive()
.Modifier | Constructor and Description |
---|---|
protected |
FSDataOutputStreamBuilder(FileSystem fileSystem,
Path p)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
B |
append()
Append to an existing file (optional operation).
|
B |
blockSize(long blkSize)
Set block size.
|
B |
bufferSize(int bufSize)
Set the size of the buffer to be used.
|
abstract S |
build()
Create the FSDataOutputStream to write on the file system.
|
B |
checksumOpt(org.apache.hadoop.fs.Options.ChecksumOpt chksumOpt)
Set checksum opt.
|
B |
create()
Create an FSDataOutputStream at the specified path.
|
protected long |
getBlockSize() |
protected int |
getBufferSize() |
protected org.apache.hadoop.fs.Options.ChecksumOpt |
getChecksumOpt() |
protected EnumSet<CreateFlag> |
getFlags() |
protected FileSystem |
getFS() |
protected Path |
getPath() |
protected FsPermission |
getPermission() |
protected Progressable |
getProgress() |
protected short |
getReplication() |
protected abstract B |
getThisBuilder()
Return the concrete implementation of the builder instance.
|
protected boolean |
isRecursive()
Return true to create the parent directories if they do not exist.
|
B |
overwrite(boolean overwrite)
Set to true to overwrite the existing file.
|
B |
permission(FsPermission perm)
Set permission for the file.
|
B |
progress(Progressable prog)
Set the facility of reporting progress.
|
B |
recursive()
Create the parent directory if they do not exist.
|
B |
replication(short replica)
Set replication factor.
|
protected FSDataOutputStreamBuilder(@Nonnull FileSystem fileSystem, @Nonnull Path p)
protected abstract B getThisBuilder()
protected FileSystem getFS()
protected Path getPath()
protected FsPermission getPermission()
public B permission(@Nonnull FsPermission perm)
protected int getBufferSize()
public B bufferSize(int bufSize)
protected short getReplication()
public B replication(short replica)
protected long getBlockSize()
public B blockSize(long blkSize)
protected boolean isRecursive()
public B recursive()
protected Progressable getProgress()
public B progress(@Nonnull Progressable prog)
protected EnumSet<CreateFlag> getFlags()
public B create()
public B overwrite(boolean overwrite)
build()
if the file exists.public B append()
protected org.apache.hadoop.fs.Options.ChecksumOpt getChecksumOpt()
public B checksumOpt(@Nonnull org.apache.hadoop.fs.Options.ChecksumOpt chksumOpt)
public abstract S build() throws IOException
HadoopIllegalArgumentException
- if the parameters are not valid.IOException
- on errors when file system creates or appends the file.Copyright © 2022 Apache Software Foundation. All rights reserved.