public interface IFileRelativeIO extends IPathRelativeIO
IPathRelativeIO version that uses files as the basis.| Modifier and Type | Method and Description |
|---|---|
default ESuccess |
appendFile(String sRelativePath,
byte[] aBytes)
Helper function for saving a file with correct error handling.
|
default ESuccess |
appendFile(String sRelativePath,
String sContent,
Charset aCharset)
Helper function for saving a file with correct error handling.
|
default FileIOError |
createDirectory(String sRelativePath,
boolean bRecursive)
Create the appropriate directory if it is not existing
|
default FileIOError |
deleteDirectory(String sRelativePath,
boolean bDeleteRecursively) |
default FileIOError |
deleteDirectoryIfExisting(String sRelativePath,
boolean bDeleteRecursively) |
default FileIOError |
deleteFile(String sRelativePath) |
default FileIOError |
deleteFileIfExisting(String sRelativePath) |
default boolean |
existsDir(String sRelativePath)
Check if a directory relative to the base path exists
|
default boolean |
existsFile(String sRelativePath)
Check if a file relative to the base path exists
|
default String |
getBasePath() |
File |
getBasePathFile() |
default File |
getFile(String sRelativePath)
Get a
File relative to the base path. |
default OutputStream |
getOutputStream(String sRelativePath)
Get the
OutputStream relative to the base path. |
default OutputStream |
getOutputStream(String sRelativePath,
EAppend eAppend)
Get the
OutputStream relative to the base path |
default String |
getRelativeFilename(File aAbsoluteFile)
Get the relative file name for the passed absolute file.
|
default FileSystemResource |
getResource(String sRelativePath)
Get the file system resource relative to the base path
|
default Writer |
getWriter(String sRelativePath,
Charset aCharset)
Get the
Writer relative to the base path. |
default Writer |
getWriter(String sRelativePath,
Charset aCharset,
EAppend eAppend)
Get the
Writer relative to the base path. |
default FileIOError |
renameDir(String sOldDirName,
String sNewDirName) |
default FileIOError |
renameFile(String sOldFilename,
String sNewFilename) |
default ESuccess |
saveFile(String sRelativePath,
byte[] aBytes)
Helper function for saving a file with correct error handling.
|
default ESuccess |
saveFile(String sRelativePath,
String sContent,
Charset aCharset)
Helper function for saving a file with correct error handling.
|
default ESuccess |
writeFile(String sRelativePath,
EAppend eAppend,
byte[] aBytes)
Helper function for saving a file with correct error handling.
|
getInputStream, getReader@Nonnull @Nonempty default String getBasePath()
getBasePath in interface IPathRelativeIOnull nor
empty.@Nonnull default File getFile(@Nonnull String sRelativePath)
File relative to the base path.sRelativePath - the relative pathFile and never null.getBasePathFile()@Nonnull default FileSystemResource getResource(@Nonnull String sRelativePath)
getResource in interface IPathRelativeIOsRelativePath - the relative pathFileSystemResource and never
null.getBasePathFile()@Nullable default String getRelativeFilename(@Nonnull File aAbsoluteFile)
aAbsoluteFile - The non-null absolute file to make relative.null if the passed file is not a child of this base
directory.default boolean existsFile(@Nonnull String sRelativePath)
sRelativePath - the relative pathtrue if the File is a file and exists,
false otherwise.getBasePathFile()default boolean existsDir(@Nonnull String sRelativePath)
sRelativePath - the relative pathtrue if the File is a directory and exists,
false otherwise.getBasePathFile()@Nullable default OutputStream getOutputStream(@Nonnull String sRelativePath)
OutputStream relative to the base path. An eventually
existing file is truncated.sRelativePath - the relative pathnull if the path is not writablegetBasePathFile()@Nullable default OutputStream getOutputStream(@Nonnull String sRelativePath, @Nonnull EAppend eAppend)
OutputStream relative to the base pathsRelativePath - the relative patheAppend - Append or truncate mode. May not be null.null if the path is not writablegetBasePathFile()@Nullable default Writer getWriter(@Nonnull String sRelativePath, @Nonnull Charset aCharset)
Writer relative to the base path. An eventually existing
file is truncated.sRelativePath - the relative pathaCharset - The charset to use. May not be null.null if the path is not writablegetBasePathFile()@Nullable default Writer getWriter(@Nonnull String sRelativePath, @Nonnull Charset aCharset, @Nonnull EAppend eAppend)
Writer relative to the base path.sRelativePath - the relative pathaCharset - The charset to use. May not be null.eAppend - Append or truncate mode. May not be null.null if the path is not writablegetBasePathFile()@Nonnull default FileIOError createDirectory(@Nonnull String sRelativePath, boolean bRecursive)
sRelativePath - the relative pathbRecursive - if true all missing parent directories will be creatednull.getBasePathFile()@Nonnull default FileIOError deleteDirectory(@Nonnull String sRelativePath, boolean bDeleteRecursively)
@Nonnull default FileIOError deleteDirectoryIfExisting(@Nonnull String sRelativePath, boolean bDeleteRecursively)
@Nonnull default FileIOError deleteFile(@Nonnull String sRelativePath)
@Nonnull default FileIOError deleteFileIfExisting(@Nonnull String sRelativePath)
@Nonnull default FileIOError renameDir(@Nonnull String sOldDirName, @Nonnull String sNewDirName)
@Nonnull default FileIOError renameFile(@Nonnull String sOldFilename, @Nonnull String sNewFilename)
@Nonnull default ESuccess writeFile(@Nonnull String sRelativePath, @Nonnull EAppend eAppend, @Nonnull byte[] aBytes)
sRelativePath - name of the file. May not be null.eAppend - Appending mode. May not be null.aBytes - the bytes to be written. May not be null.ESuccess@Nonnull default ESuccess saveFile(@Nonnull String sRelativePath, @Nonnull String sContent, @Nonnull Charset aCharset)
sRelativePath - name of the file. May not be null.sContent - the content to save. May not be null.aCharset - The character set to use. May not be null.ESuccess@Nonnull default ESuccess saveFile(@Nonnull String sRelativePath, byte[] aBytes)
sRelativePath - name of the file. May not be null.aBytes - the bytes to be written. May not be null.ESuccess@Nonnull default ESuccess appendFile(@Nonnull String sRelativePath, @Nonnull String sContent, @Nonnull Charset aCharset)
sRelativePath - name of the file. May not be null.sContent - the content to save. May not be null.aCharset - The character set to use. May not be null.ESuccessCopyright © 2014–2017 Philip Helger. All rights reserved.