@Immutable public class FileSystemResource extends Object implements IReadWriteResource
IReadableResource and
IWritableResource interfaces for file system
objects.| Constructor and Description |
|---|
FileSystemResource(File aFile) |
FileSystemResource(File aParentFile,
String sChildPath) |
FileSystemResource(String sFilename) |
FileSystemResource(String sParentPath,
String sChildPath) |
FileSystemResource(URI aURI) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canExecute()
Tests whether the application can execute the file denoted by this abstract
pathname.
|
boolean |
canRead()
Tests whether the application can read the file denoted by this abstract
pathname.
|
boolean |
canWrite()
Tests whether the application can modify the file denoted by this abstract
pathname.
|
boolean |
equals(Object o) |
boolean |
exists() |
File |
getAsFile() |
URL |
getAsURL() |
static URL |
getAsURL(File aFile) |
InputStream |
getInputStream()
Get the input stream to read from the object.
|
static InputStream |
getInputStream(File aFile) |
OutputStream |
getOutputStream(EAppend eAppend)
Get the output stream to read from the object.
|
static OutputStream |
getOutputStream(File aFile,
EAppend eAppend) |
String |
getPath() |
FileSystemResource |
getReadableCloneForPath(String sPath) |
Reader |
getReader(Charset aCharset)
Get an
Reader based on this input stream provider using the given
charset. |
static Reader |
getReader(File aFile,
Charset aCharset) |
static Reader |
getReader(File aFile,
String sCharset)
Deprecated.
|
Reader |
getReader(String sCharset)
Deprecated.
|
String |
getResourceID() |
FileSystemResource |
getWritableCloneForPath(String sPath) |
Writer |
getWriter(Charset aCharset,
EAppend eAppend)
Get an
Writer based on this output stream provider using the given
charset. |
static Writer |
getWriter(File aFile,
Charset aCharset,
EAppend eAppend) |
static Writer |
getWriter(File aFile,
String sCharset,
EAppend eAppend)
Deprecated.
|
Writer |
getWriter(String sCharset,
EAppend eAppend)
Deprecated.
|
int |
hashCode() |
String |
toString() |
public FileSystemResource(@Nonnull String sParentPath, @Nonnull String sChildPath)
@Nonnull public String getResourceID()
getResourceID in interface IResourceBasenull resource ID used e.g. for system IDs in XML
resolving.@Nonnull public String getPath()
getPath in interface IResourceBasenull@Nullable public static InputStream getInputStream(@Nonnull File aFile)
@Nullable @Deprecated public static Reader getReader(@Nonnull File aFile, @Nonnull@Nonempty String sCharset)
@Nullable public InputStream getInputStream()
IInputStreamProviderInputStream needs to be created!getInputStream in interface IInputStreamProvidernull if resolving failed.@Nullable @Deprecated public Reader getReader(@Nonnull@Nonempty String sCharset)
IInputStreamAndReaderProviderReader based on this input stream provider using the given
charset.getReader in interface IInputStreamAndReaderProvidersCharset - The charset to use. May not be null.null if no input stream could be retrieved.@Nullable public Reader getReader(@Nonnull Charset aCharset)
IInputStreamAndReaderProviderReader based on this input stream provider using the given
charset.getReader in interface IInputStreamAndReaderProvideraCharset - The charset to use. May not be null.null if no input stream could be retrieved.@Nullable public static OutputStream getOutputStream(@Nonnull File aFile, @Nonnull EAppend eAppend)
@Nullable @Deprecated public static Writer getWriter(@Nonnull File aFile, @Nonnull@Nonempty String sCharset, @Nonnull EAppend eAppend)
@Nullable public static Writer getWriter(@Nonnull File aFile, @Nonnull Charset aCharset, @Nonnull EAppend eAppend)
@Nullable public OutputStream getOutputStream(@Nonnull EAppend eAppend)
IOutputStreamProviderOutputStream needs to be created!getOutputStream in interface IOutputStreamProvidereAppend - appending mode. May not be null.null if resolving failed.@Nullable @Deprecated public Writer getWriter(@Nonnull@Nonempty String sCharset, @Nonnull EAppend eAppend)
IOutputStreamAndWriterProviderWriter based on this output stream provider using the given
charset.getWriter in interface IOutputStreamAndWriterProvidersCharset - The charset to use. May not be null.eAppend - Appending mode. May not be null.null if no output stream could be retrieved.@Nullable public Writer getWriter(@Nonnull Charset aCharset, @Nonnull EAppend eAppend)
IOutputStreamAndWriterProviderWriter based on this output stream provider using the given
charset.getWriter in interface IOutputStreamAndWriterProvideraCharset - The charset to use. May not be null.eAppend - Appending mode. May not be null.null if no output stream could be retrieved.public boolean exists()
exists in interface IResourceBasetrue if the resource exists, false
otherwise.@Nullable public URL getAsURL()
getAsURL in interface IResourceBasenull
if this resource cannot be represented as an URL.@Nonnull public File getAsFile()
getAsFile in interface IResourceBasenull
if this resource cannot be represented as a file.@Nonnull public FileSystemResource getReadableCloneForPath(@Nonnull String sPath)
getReadableCloneForPath in interface IReadableResource@Nonnull public FileSystemResource getWritableCloneForPath(@Nonnull String sPath)
getWritableCloneForPath in interface IWritableResourcepublic boolean canRead()
true if and only if the file specified by this
abstract pathname exists and can be read by the
application; false otherwisepublic boolean canWrite()
true if and only if the file system actually contains
a file denoted by this abstract pathname and the
application is allowed to write to the file; false
otherwise.public boolean canExecute()
true if and only if the abstract pathname exists
and the application is allowed to execute the fileCopyright © 2006–2014 phloc systems. All rights reserved.