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 boolean
contains(Resource childResource)
Checks if the passed-in resource is a child ofthis
resource.Resource
createRelative(String relativePath, Namespace namespace)
Creates a resource relative to this resource.boolean
delete()
Deletes physical resource thatthis
resource points at.boolean
equals(Object obj)
InputStream
getInputStream()
Returns input stream for the resource.Namespace
getNamespace()
Returns namespace of current resource.OutputStream
getOutputStream()
Returns output stream for the resource if it is writable,null
otherwise.String
getRelativePath(Resource childResource)
Returns relative path fromthis
resource to the child one, ornull
if such path doesn't exist.int
hashCode()
String
toString()
-
Methods inherited from interface ru.curs.celesta.score.io.Resource
createRelative, createRelative
-
-
-
-
Method Detail
-
getInputStream
public InputStream getInputStream() throws IOException
Description copied from interface:Resource
Returns input stream for the resource.- Specified by:
getInputStream
in interfaceResource
- Returns:
- Throws:
IOException
- when input stream cannot be provided.
-
getOutputStream
public OutputStream getOutputStream() throws IOException
Description copied from interface:Resource
Returns output stream for the resource if it is writable,null
otherwise.- Specified by:
getOutputStream
in interfaceResource
- Returns:
- Throws:
IOException
- when output stream cannot be provided.
-
delete
public boolean delete() throws IOException
Description copied from interface:Resource
Deletes physical resource thatthis
resource points at.- Specified by:
delete
in interfaceResource
- Returns:
true
if successfully deleted orfalse
otherwise.- Throws:
IOException
- when an error happened during deletion.
-
contains
public boolean contains(Resource childResource)
Description copied from interface:Resource
Checks if the passed-in resource is a child ofthis
resource.
-
getRelativePath
public String getRelativePath(Resource childResource)
Description copied from interface:Resource
Returns relative path fromthis
resource to the child one, ornull
if such path doesn't exist.- Specified by:
getRelativePath
in interfaceResource
- Parameters:
childResource
- child resource ofthis
resource.- Returns:
-
createRelative
public Resource createRelative(String relativePath, Namespace namespace)
Description copied from interface:Resource
Creates a resource relative to this resource.- Specified by:
createRelative
in interfaceResource
- Parameters:
relativePath
- path relative tothis
resource.namespace
- name space of the created resource.- Returns:
-
getNamespace
public Namespace getNamespace()
Description copied from interface:Resource
Returns namespace of current resource.- Specified by:
getNamespace
in interfaceResource
- Returns:
-
-