public abstract class TextResourceBase extends Object implements IHtmlResource
Base class for any supported text resource with text content and encoding
Modifier and Type | Field and Description |
---|---|
com.groupdocs.editor.handler.Event<com.groupdocs.editor.handler.EventHandler> |
Disposed |
Constructor and Description |
---|
TextResourceBase(String name,
InputStream binaryContent,
Charset originalEncoding)
Creates new text resource from specified byte stream and encoding
|
TextResourceBase(String name,
String textualContent,
Charset originalEncoding)
Creates new text resource from specified textual content with encoding
|
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Disposes this text resource, disposing its content and making most
methods and properties non-working.
|
boolean |
equals(IHtmlResource other)
Checks this instance with specified on equality.
|
InputStream |
getByteContent()
Returns content of this text resource as byte stream with original
encoding
|
Charset |
getEncoding()
Returns encoding of this textual resource.
|
String |
getFilenameWithExtension()
Returns correct filename of this text resource, which consists of name
and extension
|
String |
getName()
Returns name of this text resource without file extension
|
String |
getTextContent()
Returns content of this text resource as a standard string
|
abstract TextType |
getType()
In implementing type should return information about type of the text
resource
|
boolean |
isDisposed()
Determines whether this text resource is disposed or not
|
void |
save(String fullPathToFile)
Saves this text resource to the specified file
|
public final com.groupdocs.editor.handler.Event<com.groupdocs.editor.handler.EventHandler> Disposed
public TextResourceBase(String name, InputStream binaryContent, Charset originalEncoding)
Creates new text resource from specified byte stream and encoding
name
- Mandatory name of the resource, that serves as its unique
identifier. Usually is a file name.binaryContent
- Binary content of a resource as a byte stream.
Cannot be NULL, disposed, should be readable and seekable.originalEncoding
- Original encoding of the resource, cannot be NULL
or emptypublic TextResourceBase(String name, String textualContent, Charset originalEncoding)
Creates new text resource from specified textual content with encoding
name
- Mandatory name of the resource, that serves as its unique
identifier. Usually is a file name.textualContent
- Textual content of the resource, cannot be NULL or
emptyoriginalEncoding
- Original encoding of the resource, cannot be NULL
or emptypublic final void dispose()
Disposes this text resource, disposing its content and making most methods and properties non-working. Tolerant to multiple calls.
dispose
in interface com.groupdocs.editor.interfaces.IDisposable
public final boolean equals(IHtmlResource other)
Checks this instance with specified on equality.
other
- Other HTML resource of unknown type, that is also presumable
TextResourceBase inheritorpublic final InputStream getByteContent()
Returns content of this text resource as byte stream with original encoding
getByteContent
in interface IHtmlResource
public final Charset getEncoding()
Returns encoding of this textual resource. Usually returns UTF-8.
public final String getFilenameWithExtension()
Returns correct filename of this text resource, which consists of name and extension
getFilenameWithExtension
in interface IHtmlResource
public final String getName()
Returns name of this text resource without file extension
getName
in interface IHtmlResource
public final String getTextContent()
Returns content of this text resource as a standard string
getTextContent
in interface IHtmlResource
public abstract TextType getType()
In implementing type should return information about type of the text resource
getType
in interface IHtmlResource
public final boolean isDisposed()
Determines whether this text resource is disposed or not
isDisposed
in interface IAuxDisposable
public final void save(String fullPathToFile)
Saves this text resource to the specified file
save
in interface IHtmlResource
fullPathToFile
- Full path to the file, which will be created or
rewritten if already exists