Class PlainTextSerializer

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String MIME_TYPE  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getBufferSize()  
      boolean getExpandTabs()  
      java.lang.String getMIMEType​(Document document)
      Returns the MIME type of the data read and written by this serializer.
      int getTabWidth()  
      Document readObject​(java.io.InputStream inputStream)
      Reads an object from an input stream.
      Document readObject​(java.io.Reader reader)  
      void setBufferSize​(int bufferSize)
      Sets the buffer size used internally for reading and writing.
      void setExpandTabs​(boolean expandTabs)
      Sets whether tab characters (\t) are expanded to an appropriate number of spaces while reading the text.
      void setTabWidth​(int tabWidth)  
      void writeObject​(Document document, java.io.OutputStream outputStream)
      Writes an object to an output stream.
      void writeObject​(Document document, java.io.Writer writer)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PlainTextSerializer

        public PlainTextSerializer()
      • PlainTextSerializer

        public PlainTextSerializer​(java.lang.String charsetName)
      • PlainTextSerializer

        public PlainTextSerializer​(java.nio.charset.Charset charset)
    • Method Detail

      • getTabWidth

        public int getTabWidth()
      • setTabWidth

        public void setTabWidth​(int tabWidth)
      • getExpandTabs

        public boolean getExpandTabs()
      • setExpandTabs

        public void setExpandTabs​(boolean expandTabs)
        Sets whether tab characters (\t) are expanded to an appropriate number of spaces while reading the text.
        Parameters:
        expandTabs - true to replace tab characters with space characters (depending on the setting of the getTabWidth() value) or false to leave tabs alone.
      • getBufferSize

        public int getBufferSize()
      • setBufferSize

        public void setBufferSize​(int bufferSize)
        Sets the buffer size used internally for reading and writing. The default value is Constants.BUFFER_SIZE. A value of 0 will use the default value in the BufferedReader and BufferedWriter classes (probably 8192).
        Parameters:
        bufferSize - The new buffer size to use (or 0 to use the system default).
      • readObject

        public Document readObject​(java.io.InputStream inputStream)
                            throws java.io.IOException
        Description copied from interface: Serializer
        Reads an object from an input stream.
        Specified by:
        readObject in interface Serializer<Document>
        Parameters:
        inputStream - The data stream from which the object will be read.
        Returns:
        The deserialized object.
        Throws:
        java.io.IOException - for any errors accessing or reading the object.
      • readObject

        public Document readObject​(java.io.Reader reader)
                            throws java.io.IOException
        Throws:
        java.io.IOException
      • writeObject

        public void writeObject​(Document document,
                                java.io.OutputStream outputStream)
                         throws java.io.IOException
        Description copied from interface: Serializer
        Writes an object to an output stream.
        Specified by:
        writeObject in interface Serializer<Document>
        Parameters:
        document - The object to serialize.
        outputStream - The data stream to which the object will be written.
        Throws:
        java.io.IOException - for any errors accessing or reading the object.
      • writeObject

        public void writeObject​(Document document,
                                java.io.Writer writer)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • getMIMEType

        public java.lang.String getMIMEType​(Document document)
        Description copied from interface: Serializer
        Returns the MIME type of the data read and written by this serializer.
        Specified by:
        getMIMEType in interface Serializer<Document>
        Parameters:
        document - If provided, allows the serializer to attach parameters to the returned MIME type containing more detailed information about the data. If null, the base MIME type is returned.
        Returns:
        The MIME type of the current data.