TextResourceBase
Leave feedback
On this page
Inheritance: java.lang.Object
All Implemented Interfaces: com.groupdocs.editor.htmlcss.resources.IHtmlResource
public abstract class TextResourceBase implements IHtmlResource
Base class for any supported text resource with text content and encoding
| Constructor | Description |
|---|---|
| TextResourceBase(String name, String textualContent, Charset originalEncoding) | Creates new text resource from specified textual content with encoding |
| TextResourceBase(String name, InputStream binaryContent, Charset originalEncoding) | Creates new text resource from specified byte stream and encoding |
| Field | Description |
|---|---|
| Disposed |
| Method | Description |
|---|---|
| getName() | Returns name of this text resource without file extension |
| getFilenameWithExtension() | Returns correct filename of this text resource, which consists of name and extension |
| getEncoding() | Returns encoding of this textual resource. |
| getByteContent() | Returns content of this text resource as byte stream with original encoding |
| getTextContent() | Returns content of this text resource as a standard string |
| save(String fullPathToFile) | Saves this text resource to the specified file |
| equals(IHtmlResource other) | Checks this instance with specified on equality. |
| dispose() | Disposes this text resource, disposing its content and making most methods and properties non-working. |
| isDisposed() | Determines whether this text resource is disposed or not |
| getType() | In implementing type should return information about type of the text resource |
public TextResourceBase(String name, String textualContent, Charset originalEncoding)
Creates new text resource from specified textual content with encoding
Parameters:
| Parameter | Type | Description |
|---|---|---|
| name | java.lang.String | Mandatory name of the resource, that serves as its unique identifier. Usually is a file name. |
| textualContent | java.lang.String | Textual content of the resource, cannot be NULL or empty |
| originalEncoding | java.nio.charset.Charset | Original encoding of the resource, cannot be NULL or empty |
public TextResourceBase(String name, InputStream binaryContent, Charset originalEncoding)
Creates new text resource from specified byte stream and encoding
Parameters:
| Parameter | Type | Description |
|---|---|---|
| name | java.lang.String | Mandatory name of the resource, that serves as its unique identifier. Usually is a file name. |
| binaryContent | java.io.InputStream | Binary content of a resource as a byte stream. Cannot be NULL, disposed, should be readable and seekable. |
| originalEncoding | java.nio.charset.Charset | Original encoding of the resource, cannot be NULL or empty |
public final Event<EventHandler> Disposed
public final String getName()
Returns name of this text resource without file extension
Returns: java.lang.String
public final String getFilenameWithExtension()
Returns correct filename of this text resource, which consists of name and extension
Returns: java.lang.String
public final Charset getEncoding()
Returns encoding of this textual resource. Usually returns UTF-8.
Returns: java.nio.charset.Charset -
public final InputStream getByteContent()
Returns content of this text resource as byte stream with original encoding
Returns: java.io.InputStream -
public final String getTextContent()
Returns content of this text resource as a standard string
Returns: java.lang.String -
public final void save(String fullPathToFile)
Saves this text resource to the specified file
Parameters:
| Parameter | Type | Description |
|---|---|---|
| fullPathToFile | java.lang.String | Full path to the file, which will be created or rewritten if already exists |
public final boolean equals(IHtmlResource other)
Checks this instance with specified on equality.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| other | IHtmlResource | Other HTML resource of unknown type, that is also presumable TextResourceBase inheritor |
Returns: boolean - Returns true if are equal, or false if are unequal
public final void dispose()
Disposes this text resource, disposing its content and making most methods and properties non-working. Tolerant to multiple calls.
public final boolean isDisposed()
Determines whether this text resource is disposed or not
Returns: boolean -
public abstract TextType getType()
In implementing type should return information about type of the text resource
Returns: TextType
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.