@ParametersAreNonnullByDefault public class FileSystemOptionsFactory extends Object
The default implementation supposes support for the following options:
StandardOpenOption.CREATE;StandardOpenOption.CREATE_NEW;StandardOpenOption.READ;StandardOpenOption.SPARSE;StandardOpenOption.TRUNCATE_EXISTING;StandardOpenOption.WRITE;StandardCopyOption.REPLACE_EXISTING.Extend this class if you want to add support for further options. For instance, if atomic move is supported:
public final class MyFileSystemOptionsRepository
extends FileSystemOptionsRepository
{
public MyFileSystemOptionsRepository()
{
addCopyOption(StandardCopyOption.ATOMIC_MOVE);
}
}
Unless otherwise noted, all methods in this class will throw a NullPointerException if a null argument is passed.
| Constructor and Description |
|---|
FileSystemOptionsFactory() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addCopyOption(CopyOption option)
Add a supported copy option
|
protected void |
addLinkOption(LinkOption option)
Add a supported link option
|
protected void |
addOpenOption(OpenOption option)
Add an option option supported for both read and write
|
protected void |
addReadOpenOption(OpenOption option)
Add an open option supported for read
|
protected void |
addReadTranslation(CopyOption option,
OpenOption translated) |
protected void |
addWriteOpenOption(OpenOption option)
Add an option option supported for write
|
protected void |
addWriteTranslation(CopyOption option,
OpenOption translated) |
void |
checkLinkOptions(LinkOption... opts) |
Set<CopyOption> |
compileCopyOptions(CopyOption... opts)
Compile a set of copy options from a
CopyOption array |
Set<OpenOption> |
compileReadOptions(OpenOption... opts)
Compile a set of read options from a given
OpenOption array |
Set<OpenOption> |
compileWriteOptions(OpenOption... opts)
Compile a set of read options from a given
OpenOption array |
Set<OpenOption> |
toReadOptions(Set<CopyOption> options) |
Set<OpenOption> |
toWriteOptions(Set<CopyOption> options) |
@Nonnull public final Set<OpenOption> compileReadOptions(OpenOption... opts)
OpenOption array
The result set will have at least StandardOpenOption.READ if
it is not already present.
opts - the options arrayUnsupportedOptionException - one or more options are not supportedIllegalOptionSetException - some options are unsuited for read@Nonnull public final Set<OpenOption> compileWriteOptions(OpenOption... opts)
OpenOption array
The result set will have at least StandardOpenOption.WRITE if
it is not already present.
opts - the options arrayUnsupportedOptionException - one or more options are not supportedIllegalOptionSetException - some options are unsuited for write@Nonnull public final Set<CopyOption> compileCopyOptions(CopyOption... opts)
CopyOption arrayopts - the options arraypublic final void checkLinkOptions(LinkOption... opts)
@Nonnull public final Set<OpenOption> toReadOptions(Set<CopyOption> options)
@Nonnull public final Set<OpenOption> toWriteOptions(Set<CopyOption> options)
protected final void addReadOpenOption(OpenOption option)
option - the optionprotected final void addWriteOpenOption(OpenOption option)
option - the optionprotected final void addOpenOption(OpenOption option)
option - the optionprotected final void addCopyOption(CopyOption option)
option - the optionprotected final void addLinkOption(LinkOption option)
option - the optionprotected final void addReadTranslation(CopyOption option, OpenOption translated)
protected final void addWriteTranslation(CopyOption option, OpenOption translated)