public class FileSystemResource extends BaseResource implements InternalResource, Externalizable
Constructor and Description |
---|
FileSystemResource() |
FileSystemResource(File file)
Create a new FileSystemResource from a File handle.
|
FileSystemResource(File file,
String encoding) |
FileSystemResource(String path)
Create a new FileSystemResource from a file path.
|
FileSystemResource(String path,
String encoding) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object object) |
String |
getEncoding() |
File |
getFile() |
InputStream |
getInputStream()
This implementation opens a FileInputStream for the underlying file.
|
long |
getLastModified() |
long |
getLastRead() |
Reader |
getReader() |
URL |
getURL()
This implementation returns a URL for the underlying file.
|
int |
hashCode() |
boolean |
hasURL() |
boolean |
isDirectory() |
Collection<org.kie.api.io.Resource> |
listResources() |
void |
readExternal(ObjectInput in) |
String |
toString() |
void |
writeExternal(ObjectOutput out) |
addCategory, getBytes, getCategories, getConfiguration, getDescription, getResourceType, getSourcePath, getTargetPath, setCategories, setConfiguration, setDescription, setResourceType, setSourcePath, setTargetPath
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addCategory, getBytes, getCategories, getConfiguration, getDescription, getResourceType, setCategories, setConfiguration, setDescription, setResourceType
public FileSystemResource()
public FileSystemResource(File file)
Note: When building relative resources via #createRelative
,
the relative path will apply at the same directory level:
e.g. new File("C:/dir1"), relative path "dir2" -> "C:/dir2"!
If you prefer to have relative paths built underneath the given root
directory, use the constructor with a file path
to append a trailing slash to the root path: "C:/dir1/", which
indicates this directory as root for all relative paths.
file
- a File handlepublic FileSystemResource(String path)
Note: When building relative resources via #createRelative
,
it makes a difference whether the specified resource base path here
ends with a slash or not. In the case of "C:/dir1/", relative paths
will be built underneath that root: e.g. relative path "dir2" ->
"C:/dir1/dir2". In the case of "C:/dir1", relative paths will apply
at the same directory level: relative path "dir2" -> "C:/dir2".
path
- a file pathpublic void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
writeExternal
in class BaseResource
IOException
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
readExternal
in class BaseResource
IOException
ClassNotFoundException
public String getEncoding()
getEncoding
in interface InternalResource
public InputStream getInputStream() throws IOException
getInputStream
in interface org.kie.api.io.Resource
IOException
FileInputStream
public Reader getReader() throws IOException
getReader
in interface org.kie.api.io.Resource
IOException
public File getFile()
public boolean isDirectory()
isDirectory
in interface InternalResource
public Collection<org.kie.api.io.Resource> listResources()
listResources
in interface InternalResource
public URL getURL() throws IOException
getURL
in interface InternalResource
IOException
File.toURI()
public boolean hasURL()
hasURL
in interface InternalResource
public long getLastModified()
getLastModified
in interface InternalResource
public long getLastRead()
getLastRead
in interface InternalResource
public String toString()
toString
in class BaseResource
public boolean equals(Object object)
equals
in class BaseResource
public int hashCode()
hashCode
in class BaseResource
Copyright © 2001–2020 JBoss by Red Hat. All rights reserved.