Class FileSystemResource
- All Implemented Interfaces:
Externalizable,Serializable,InternalResource,Resource
- See Also:
-
Field Summary
Fields inherited from class org.drools.io.BaseResource
bytes -
Constructor Summary
ConstructorsConstructorDescriptionFileSystemResource(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) -
Method Summary
Methods inherited from class org.drools.io.BaseResource
addCategory, getBytes, getCategories, getConfiguration, getDescription, getResourceType, getSourcePath, getTargetPath, setCategories, setConfiguration, setDescription, setResourceType, setSourcePath, setTargetPathMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.drools.io.InternalResource
addCategory, getBytes, getCategories, getConfiguration, getDescription, getResourceType, setCategories, setConfiguration, setDescription, setResourceTypeMethods inherited from interface org.kie.api.io.Resource
getSourcePath, getTargetPath, setSourcePath, setTargetPath
-
Constructor Details
-
FileSystemResource
public FileSystemResource() -
FileSystemResource
Create a new FileSystemResource from a File handle.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 theconstructor with a file pathto append a trailing slash to the root path: "C:/dir1/", which indicates this directory as root for all relative paths.- Parameters:
file- a File handle
-
FileSystemResource
-
FileSystemResource
Create a new FileSystemResource from a file 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".- Parameters:
path- a file path
-
FileSystemResource
-
-
Method Details
-
writeExternal
- Specified by:
writeExternalin interfaceExternalizable- Overrides:
writeExternalin classBaseResource- Throws:
IOException
-
readExternal
- Specified by:
readExternalin interfaceExternalizable- Overrides:
readExternalin classBaseResource- Throws:
IOExceptionClassNotFoundException
-
getEncoding
- Specified by:
getEncodingin interfaceInternalResource
-
getInputStream
This implementation opens a FileInputStream for the underlying file.- Specified by:
getInputStreamin interfaceResource- Throws:
IOException- See Also:
-
getReader
- Specified by:
getReaderin interfaceResource- Throws:
IOException
-
getFile
-
isDirectory
public boolean isDirectory()- Specified by:
isDirectoryin interfaceInternalResource
-
listResources
- Specified by:
listResourcesin interfaceInternalResource
-
getURL
This implementation returns a URL for the underlying file.- Specified by:
getURLin interfaceInternalResource- Throws:
IOException- See Also:
-
hasURL
public boolean hasURL()- Specified by:
hasURLin interfaceInternalResource
-
toString
- Overrides:
toStringin classBaseResource
-
equals
- Overrides:
equalsin classBaseResource
-
hashCode
public int hashCode()- Overrides:
hashCodein classBaseResource
-