com.groupdocs.editor.htmlcss.resources.textual

Class TextResourceBase

  • java.lang.Object
    • com.groupdocs.editor.htmlcss.resources.textual.TextResourceBase
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      com.groupdocs.editor.handler.Event<com.groupdocs.editor.handler.EventHandler> Disposed 
    • Field Detail

      • Disposed

        public final com.groupdocs.editor.handler.Event<com.groupdocs.editor.handler.EventHandler> Disposed
    • Constructor Detail

      • TextResourceBase

        public TextResourceBase(String name,
                        InputStream binaryContent,
                        Charset originalEncoding)

        Creates new text resource from specified byte stream and encoding

        Parameters:
        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 empty
      • TextResourceBase

        public TextResourceBase(String name,
                        String textualContent,
                        Charset originalEncoding)

        Creates new text resource from specified textual content with encoding

        Parameters:
        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 empty
        originalEncoding - Original encoding of the resource, cannot be NULL or empty
    • Method Detail

      • dispose

        public final void dispose()

        Disposes this text resource, disposing its content and making most methods and properties non-working. Tolerant to multiple calls.

        Specified by:
        dispose in interface com.groupdocs.editor.interfaces.IDisposable
      • equals

        public final boolean equals(IHtmlResource other)

        Checks this instance with specified on equality.

        Parameters:
        other - Other HTML resource of unknown type, that is also presumable TextResourceBase inheritor
        Returns:
        Returns true if are equal, or false if are unequal
      • getByteContent

        public final InputStream getByteContent()

        Returns content of this text resource as byte stream with original encoding

        Specified by:
        getByteContent in interface IHtmlResource
        Returns:
      • getEncoding

        public final Charset getEncoding()

        Returns encoding of this textual resource. Usually returns UTF-8.

        Returns:
      • getFilenameWithExtension

        public final String getFilenameWithExtension()

        Returns correct filename of this text resource, which consists of name and extension

        Specified by:
        getFilenameWithExtension in interface IHtmlResource
        Returns:
      • getName

        public final String getName()

        Returns name of this text resource without file extension

        Specified by:
        getName in interface IHtmlResource
        Returns:
      • getTextContent

        public final String getTextContent()

        Returns content of this text resource as a standard string

        Specified by:
        getTextContent in interface IHtmlResource
        Returns:
      • getType

        public abstract TextType getType()

        In implementing type should return information about type of the text resource

        Specified by:
        getType in interface IHtmlResource
        Returns:
      • isDisposed

        public final boolean isDisposed()

        Determines whether this text resource is disposed or not

        Specified by:
        isDisposed in interface IAuxDisposable
        Returns:
      • save

        public final void save(String fullPathToFile)

        Saves this text resource to the specified file

        Specified by:
        save in interface IHtmlResource
        Parameters:
        fullPathToFile - Full path to the file, which will be created or rewritten if already exists