Package org.ringojs.repository
Class FileResource
- java.lang.Object
-
- org.ringojs.repository.AbstractResource
-
- org.ringojs.repository.FileResource
-
public class FileResource extends AbstractResource
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.ringojs.repository.AbstractResource
baseName, name, path, repository
-
-
Constructor Summary
Constructors Modifier Constructor Description FileResource(java.io.File file)
protected
FileResource(java.io.File file, FileRepository repository)
FileResource(java.lang.String path)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
boolean
exists()
Checks wether this resource actually (still) existsjava.io.InputStream
getInputStream()
Returns an input stream to the content of the resourcelong
getLength()
Returns the length of the resource's contentjava.net.URL
getUrl()
Returns an url to the resource if the repository of this resource is able to provide urls.int
hashCode()
long
lastModified()
Returns the date the resource was last modifiedjava.lang.String
toString()
-
Methods inherited from class org.ringojs.repository.AbstractResource
getBaseName, getChecksum, getContent, getContent, getLineNumber, getModuleName, getName, getParentRepository, getPath, getReader, getReader, getRelativePath, getRootRepository, getStripShebang, isAbsolute, setAbsolute, setBaseNameFromName, setStripShebang, stripShebang
-
-
-
-
Constructor Detail
-
FileResource
public FileResource(java.lang.String path) throws java.io.IOException
- Throws:
java.io.IOException
-
FileResource
public FileResource(java.io.File file) throws java.io.IOException
- Throws:
java.io.IOException
-
FileResource
protected FileResource(java.io.File file, FileRepository repository) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
getInputStream
public java.io.InputStream getInputStream() throws java.io.IOException
Description copied from interface:Resource
Returns an input stream to the content of the resource- Returns:
- content input stream
- Throws:
java.io.IOException
- if a I/O related error occurs
-
getUrl
public java.net.URL getUrl() throws java.net.MalformedURLException
Description copied from interface:Trackable
Returns an url to the resource if the repository of this resource is able to provide urls.- Returns:
- url to the resource
- Throws:
java.net.MalformedURLException
-
lastModified
public long lastModified()
Description copied from interface:Trackable
Returns the date the resource was last modified- Returns:
- last modified date
-
getLength
public long getLength()
Description copied from interface:Resource
Returns the length of the resource's content- Returns:
- content length
-
exists
public boolean exists()
Description copied from interface:Trackable
Checks wether this resource actually (still) exists- Returns:
- true if the resource exists
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-