Class GrailsPrintWriter

    • Field Detail

      • LOG

        protected static final org.apache.commons.logging.Log LOG
      • CRLF

        protected static final char[] CRLF
      • trouble

        protected boolean trouble
      • out

        protected java.io.Writer out
      • allowUnwrappingOut

        protected boolean allowUnwrappingOut
      • usageFlag

        protected boolean usageFlag
      • streamCharBufferTarget

        protected java.io.Writer streamCharBufferTarget
      • previousOut

        protected java.io.Writer previousOut
    • Constructor Detail

      • GrailsPrintWriter

        public GrailsPrintWriter​(java.io.Writer out)
    • Method Detail

      • isDestinationActivated

        public boolean isDestinationActivated()
      • getOut

        public java.io.Writer getOut()
      • setOut

        public void setOut​(java.io.Writer newOut)
      • unwrapWriter

        protected java.io.Writer unwrapWriter​(java.io.Writer writer)
      • leftShift

        public GrailsPrintWriter leftShift​(java.lang.Object obj)
                                    throws java.io.IOException
        Provides Groovy << left shift operator, but intercepts call to make sure nulls are converted to "" strings
        Parameters:
        obj - The value
        Returns:
        Returns this object
        Throws:
        java.io.IOException
      • plus

        public GrailsPrintWriter plus​(java.lang.Object value)
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • checkError

        public boolean checkError()
        Flush the stream if it's not closed and check its error state. Errors are cumulative; once the stream encounters an error, this routine will return true on all successive calls.
        Returns:
        true if the print stream has encountered an error, either on the underlying output stream or during a format conversion.
      • setError

        public void setError()
      • flush

        public void flush()
        Flush the stream.
        Specified by:
        flush in interface java.io.Flushable
        Specified by:
        flush in class java.io.Writer
        See Also:
        checkError()
      • print

        public void print​(java.lang.Object obj)
        Print an object. The string produced by the String.valueOf(Object) method is translated into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the write(int) method.
        Parameters:
        obj - The Object to be printed
        See Also:
        Object.toString()
      • print

        public void print​(java.lang.String s)
        Print a string. If the argument is null then the string "" is printed. Otherwise, the string's characters are converted into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the write(int) method.
        Parameters:
        s - The String to be printed
      • write

        public void write​(java.lang.String s)
        Writes a string. If the argument is null then the string "" is printed.
        Overrides:
        write in class java.io.Writer
        Parameters:
        s - The String to be printed
      • write

        public void write​(int c)
        Write a single character.
        Overrides:
        write in class java.io.Writer
        Parameters:
        c - int specifying a character to be written.
      • write

        public void write​(char[] buf,
                          int off,
                          int len)
        Write a portion of an array of characters.
        Specified by:
        write in class java.io.Writer
        Parameters:
        buf - Array of characters
        off - Offset from which to start writing characters
        len - Number of characters to write
      • write

        public void write​(java.lang.String s,
                          int off,
                          int len)
        Write a portion of a string.
        Overrides:
        write in class java.io.Writer
        Parameters:
        s - A String
        off - Offset from which to start writing characters
        len - Number of characters to write
      • write

        public void write​(char[] buf)
        Overrides:
        write in class java.io.Writer
      • print

        public void print​(boolean b)
        delegate methods, not synchronized
      • print

        public void print​(char c)
      • print

        public void print​(int i)
      • print

        public void print​(long l)
      • print

        public void print​(float f)
      • print

        public void print​(double d)
      • print

        public void print​(char[] s)
      • println

        public void println()
      • println

        public void println​(boolean b)
      • println

        public void println​(char c)
      • println

        public void println​(int i)
      • println

        public void println​(long l)
      • println

        public void println​(float f)
      • println

        public void println​(double d)
      • println

        public void println​(char[] c)
      • println

        public void println​(java.lang.String s)
      • println

        public void println​(java.lang.Object o)
      • append

        public GrailsPrintWriter append​(char c)
        Specified by:
        append in interface java.lang.Appendable
        Overrides:
        append in class java.io.Writer
      • append

        public GrailsPrintWriter append​(java.lang.CharSequence csq,
                                        int start,
                                        int end)
        Specified by:
        append in interface java.lang.Appendable
        Overrides:
        append in class java.io.Writer
      • appendNullCharSequence

        protected void appendNullCharSequence()
                                       throws java.io.IOException
        Throws:
        java.io.IOException
      • append

        public GrailsPrintWriter append​(java.lang.CharSequence csq)
        Specified by:
        append in interface java.lang.Appendable
        Overrides:
        append in class java.io.Writer
      • clone

        protected java.lang.Object clone()
                                  throws java.lang.CloneNotSupportedException
        Overrides:
        clone in class java.lang.Object
        Throws:
        java.lang.CloneNotSupportedException
      • findStreamCharBufferTarget

        protected java.io.Writer findStreamCharBufferTarget​(boolean markUsed)
      • write

        public void write​(groovy.lang.Writable writable)
      • writeWritable

        protected void writeWritable​(groovy.lang.Writable writable)
      • print

        public void print​(groovy.lang.Writable writable)
      • print

        public void print​(org.codehaus.groovy.runtime.GStringImpl gstring)
      • leftShift

        public GrailsPrintWriter leftShift​(org.codehaus.groovy.runtime.GStringImpl gstring)
      • isUsed

        public boolean isUsed()
      • setUsed

        public void setUsed​(boolean newUsed)
      • resetUsed

        public boolean resetUsed()
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in class java.io.Writer
      • asType

        public java.lang.Object asType​(java.lang.Class<?> clazz)
      • asPrintWriter

        public java.io.PrintWriter asPrintWriter()
      • getWriterForEncoder

        public java.io.Writer getWriterForEncoder​(Encoder encoder,
                                                  EncodingStateRegistry encodingStateRegistry)
        Description copied from interface: EncodedAppenderWriterFactory
        Gets the EncodedAppenderWriter instance that is connected to this instance implementation with a certain encoder fixed.
        Specified by:
        getWriterForEncoder in interface EncodedAppenderWriterFactory
        Parameters:
        encoder - the encoder to use
        encodingStateRegistry - the current EncodingStateRegistry to use
        Returns:
        the java.io.Writer instance
      • getProperty

        public java.lang.Object getProperty​(java.lang.String property)
        Specified by:
        getProperty in interface groovy.lang.GroovyObject
      • setProperty

        public void setProperty​(java.lang.String property,
                                java.lang.Object newValue)
        Specified by:
        setProperty in interface groovy.lang.GroovyObject
      • invokeMethod

        public java.lang.Object invokeMethod​(java.lang.String name,
                                             java.lang.Object args)
        Specified by:
        invokeMethod in interface groovy.lang.GroovyObject
      • getMetaClass

        public groovy.lang.MetaClass getMetaClass()
        Specified by:
        getMetaClass in interface groovy.lang.GroovyObject
      • setMetaClass

        public void setMetaClass​(groovy.lang.MetaClass metaClass)
        Specified by:
        setMetaClass in interface groovy.lang.GroovyObject