public class StringResource extends Object implements Resource
| Constructor and Description |
|---|
StringResource(String name,
String content) |
StringResource(String name,
String content,
int lineNumber) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
exists()
Checks wether this resource actually (still) exists
|
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
|
InputStream |
getInputStream()
Returns an input stream to the content of the resource
|
long |
getLength()
Returns the length of the resource's content
|
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
|
URL |
getUrl()
Returns an url to the resource if the repository of this resource is
able to provide urls.
|
boolean |
isAbsolute()
Return true if this Trackable is in absolute mode.
|
long |
lastModified()
Returns the date the resource was last modified
|
void |
setAbsolute(boolean absolute)
Set this Trackable to absolute mode.
|
void |
setStripShebang(boolean stripShebang)
Switch shebang stripping on or off
|
public String getBaseName()
ResourcegetBaseName in interface Resourcepublic long getLength()
Resourcepublic InputStream getInputStream() throws IOException
ResourcegetInputStream in interface ResourceIOException - if a I/O related error occurspublic 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()
ResourcegetRelativePath in interface ResourcegetRelativePath 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 long lastModified()
TrackablelastModified in interface Trackablepublic long getChecksum()
throws IOException
TrackablegetChecksum in interface TrackableIOExceptionpublic boolean exists()
throws IOException
Trackableexists in interface TrackableIOExceptionpublic String getPath()
Trackablepublic String getName()
Trackablepublic URL getUrl() throws UnsupportedOperationException, MalformedURLException
TrackablegetUrl in interface TrackableUnsupportedOperationExceptionMalformedURLExceptionpublic Repository getParentRepository()
TrackablegetParentRepository in interface Trackablepublic Repository getRootRepository()
TrackablegetRootRepository in interface Trackablepublic String getModuleName()
TrackablegetModuleName in interface Trackablepublic void setAbsolute(boolean absolute)
TrackablesetAbsolute in interface Trackableabsolute - true to operate in absolute modepublic boolean isAbsolute()
TrackableisAbsolute in interface TrackableCopyright © 2016. All rights reserved.