Package ru.curs.celesta.score.io
Class FileResource
- java.lang.Object
-
- ru.curs.celesta.score.io.FileResource
-
-
Constructor Summary
Constructors Constructor Description FileResource(File file)FileResource(File file, Namespace namespace)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(Resource childResource)Checks if the passed-in resource is a child ofthisresource.ResourcecreateRelative(String relativePath, Namespace namespace)Creates a resource relative to this resource.booleandelete()Deletes physical resource thatthisresource points at.booleanequals(Object obj)InputStreamgetInputStream()Returns input stream for the resource.NamespacegetNamespace()Returns namespace of current resource.OutputStreamgetOutputStream()Returns output stream for the resource if it is writable,nullotherwise.StringgetRelativePath(Resource childResource)Returns relative path fromthisresource to the child one, ornullif such path doesn't exist.inthashCode()StringtoString()-
Methods inherited from interface ru.curs.celesta.score.io.Resource
createRelative, createRelative
-
-
-
-
Method Detail
-
getInputStream
public InputStream getInputStream() throws IOException
Description copied from interface:ResourceReturns input stream for the resource.- Specified by:
getInputStreamin interfaceResource- Returns:
- Throws:
IOException- when input stream cannot be provided.
-
getOutputStream
public OutputStream getOutputStream() throws IOException
Description copied from interface:ResourceReturns output stream for the resource if it is writable,nullotherwise.- Specified by:
getOutputStreamin interfaceResource- Returns:
- Throws:
IOException- when output stream cannot be provided.
-
delete
public boolean delete() throws IOExceptionDescription copied from interface:ResourceDeletes physical resource thatthisresource points at.- Specified by:
deletein interfaceResource- Returns:
trueif successfully deleted orfalseotherwise.- Throws:
IOException- when an error happened during deletion.
-
contains
public boolean contains(Resource childResource)
Description copied from interface:ResourceChecks if the passed-in resource is a child ofthisresource.
-
getRelativePath
public String getRelativePath(Resource childResource)
Description copied from interface:ResourceReturns relative path fromthisresource to the child one, ornullif such path doesn't exist.- Specified by:
getRelativePathin interfaceResource- Parameters:
childResource- child resource ofthisresource.- Returns:
-
createRelative
public Resource createRelative(String relativePath, Namespace namespace)
Description copied from interface:ResourceCreates a resource relative to this resource.- Specified by:
createRelativein interfaceResource- Parameters:
relativePath- path relative tothisresource.namespace- name space of the created resource.- Returns:
-
getNamespace
public Namespace getNamespace()
Description copied from interface:ResourceReturns namespace of current resource.- Specified by:
getNamespacein interfaceResource- Returns:
-
-