public abstract class AbstractResource extends Object implements Resource
| Modifier and Type | Field and Description |
|---|---|
protected String |
baseName |
protected String |
name |
protected String |
path |
protected AbstractRepository |
repository |
| Constructor and Description |
|---|
AbstractResource() |
| Modifier and Type | Method and Description |
|---|---|
String |
getBaseName()
Returns the short name of the resource with the file extension
(everything following the last dot character) cut off.
|
long |
getChecksum()
Checksum of the resource content.
|
String |
getContent()
Returns the content of the resource
|
String |
getContent(String encoding)
Returns the content of the resource in a given encoding
|
int |
getLineNumber()
Return the current line number of this resource.
|
String |
getModuleName()
Utility method to get the name for the module defined by this resource.
|
String |
getName()
Returns the short name of the resource.
|
Repository |
getParentRepository()
Returns the parent repository containing this resource
|
String |
getPath()
Returns the path of the resource.
|
Reader |
getReader()
Returns a reader for the resource
|
Reader |
getReader(String encoding)
Returns a reader for the resource using the given character encoding
|
String |
getRelativePath()
Get the path of this resource relative to its root repository.
|
Repository |
getRootRepository()
Returns the root repository of this resource
|
boolean |
getStripShebang()
Returns true if the input stream for this resource will look for a
first line starting with the characters #! and suppress it if found
|
boolean |
isAbsolute()
Return true if this Resource is in absolute mode.
|
void |
setAbsolute(boolean absolute)
Set this Resource to absolute mode.
|
protected void |
setBaseNameFromName(String name) |
void |
setStripShebang(boolean stripShebang)
Switch shebang stripping on or off
|
protected InputStream |
stripShebang(InputStream stream) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetInputStream, getLengthexists, getUrl, lastModifiedprotected AbstractRepository repository
protected String path
protected String name
protected String baseName
protected void setBaseNameFromName(String name)
public String getPath()
Trackablepublic String getName()
Trackablepublic String getBaseName()
ResourcegetBaseName in interface Resourcepublic Repository getParentRepository()
TrackablegetParentRepository in interface Trackablepublic Repository getRootRepository()
TrackablegetRootRepository in interface Trackableprotected InputStream stripShebang(InputStream stream) throws IOException
IOExceptionpublic Reader getReader(String encoding) throws IOException
ResourcegetReader in interface Resourceencoding - the character encodingIOException - if a I/O related error occurspublic Reader getReader() throws IOException
ResourcegetReader in interface ResourceIOException - if a I/O related error occurspublic String getContent(String encoding) throws IOException
ResourcegetContent in interface Resourceencoding - the character encodingIOException - if a I/O related error occurspublic String getContent() throws IOException
ResourcegetContent in interface ResourceIOException - if a I/O related error occurspublic String getRelativePath()
getRelativePath in interface ResourcegetRelativePath in interface Trackablepublic String getModuleName()
getModuleName in interface Trackablepublic long getChecksum()
TrackablegetChecksum in interface Trackablepublic boolean getStripShebang()
ResourcegetStripShebang in interface Resourcepublic void setStripShebang(boolean stripShebang)
ResourcesetStripShebang in interface ResourcestripShebang - true to enable shebang strippingpublic int getLineNumber()
ResourcegetLineNumber in interface Resourcepublic void setAbsolute(boolean absolute)
setAbsolute in interface Trackableabsolute - true to operate in absolute modepublic boolean isAbsolute()
isAbsolute in interface TrackableCopyright © 2016. All rights reserved.