GrailsPrintWriter (Grails 6.0.0)

Package: org.grails.buffer

## [Java] Class GrailsPrintWriter

- org.grails.buffer.GrailsPrintWriter

- All Implemented Interfaces and Traits:
    EncodedAppenderWriterFactory, GrailsWrappedWriter, groovy.lang.GroovyObject

      public class GrailsPrintWriter
      extends java.io.Writer
      implements EncodedAppenderWriterFactory, GrailsWrappedWriter, groovy.lang.GroovyObject

  PrintWriter implementation that doesn't have synchronization. null object references are ignored in print methods (nothing gets printed)

  Authors:
    Lari Hotari, Sagire Software Oy

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `protected static char[]` | `CRLF` |
    `protected static org.apache.commons.logging.Log` | `LOG` |
    `protected boolean` | `allowUnwrappingOut` |
    `private groovy.lang.MetaClass` | `metaClass` |
    `protected java.io.Writer` | `out` |
    `protected java.io.Writer` | `previousOut` |
    `protected java.io.Writer` | `streamCharBufferTarget` |
    `protected boolean` | `trouble` |
    `protected boolean` | `usageFlag` |

  - ### Constructor Summary

    Constructors
    Constructor and description
    `GrailsPrintWriter (java.io.Writer out)`

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public GrailsPrintWriter` | `append(char c)`
    `` | `public GrailsPrintWriter` | `append(java.lang.CharSequence csq, int start, int end)`
    `` | `public GrailsPrintWriter` | `append(java.lang.CharSequence csq)`
    `` | `public GrailsPrintWriter` | `append(java.lang.Object obj)`
    `` | `public void` | `append(StreamCharBuffer otherBuffer)`
    `` | `protected void` | `appendNullCharSequence()`
    `` | `public java.io.PrintWriter` | `asPrintWriter()`
    `` | `public java.lang.Object` | `asType(java.lang.Class<?> clazz)`
    `` | `public boolean` | `checkError()` Flush the stream if it's not closed and check its error state.
    `` | `protected java.lang.Object` | `clone()`
    `` | `public void` | `close()`
    `` | `protected java.io.Writer` | `findStreamCharBufferTarget(boolean markUsed)`
    `` | `public void` | `flush()` Flush the stream.
    `` | `public groovy.lang.MetaClass` | `getMetaClass()`
    `` | `public java.io.Writer` | `getOut()`
    `` | `public java.lang.Object` | `getProperty(java.lang.String property)`
    `` | `public java.io.Writer` | `getWriterForEncoder(Encoder encoder, EncodingStateRegistry encodingStateRegistry)`
    `` | `void` | `handleIOException(java.io.IOException e)`
    `` | `public java.lang.Object` | `invokeMethod(java.lang.String name, java.lang.Object args)`
    `` | `public boolean` | `isAllowUnwrappingOut()`
    `` | `public boolean` | `isDestinationActivated()`
    `` | `boolean` | `isTrouble()`
    `` | `public boolean` | `isUsed()`
    `` | `public GrailsPrintWriter` | `leftShift(java.lang.Object obj)` Provides Groovy << left shift operator, but intercepts call to make sure nulls are converted to "" strings
    `` | `public GrailsPrintWriter` | `leftShift(StreamCharBuffer otherBuffer)`
    `` | `public GrailsPrintWriter` | `leftShift(groovy.lang.Writable writable)`
    `` | `public GrailsPrintWriter` | `leftShift(org.codehaus.groovy.runtime.GStringImpl gstring)`
    `` | `public GrailsPrintWriter` | `leftShift(java.lang.String string)`
    `` | `public void` | `markUsed()`
    `` | `public GrailsPrintWriter` | `plus(java.lang.Object value)`
    `` | `public void` | `print(java.lang.Object obj)` Print an object.
    `` | `public void` | `print(java.lang.String s)` Print a string.
    `` | `public void` | `print(boolean b)`
    `` | `public void` | `print(char c)`
    `` | `public void` | `print(int i)`
    `` | `public void` | `print(long l)`
    `` | `public void` | `print(float f)`
    `` | `public void` | `print(double d)`
    `` | `public void` | `print(char[] s)`
    `` | `public void` | `print(StreamCharBuffer otherBuffer)`
    `` | `public void` | `print(groovy.lang.Writable writable)`
    `` | `public void` | `print(org.codehaus.groovy.runtime.GStringImpl gstring)`
    `` | `public void` | `println()`
    `` | `public void` | `println(boolean b)`
    `` | `public void` | `println(char c)`
    `` | `public void` | `println(int i)`
    `` | `public void` | `println(long l)`
    `` | `public void` | `println(float f)`
    `` | `public void` | `println(double d)`
    `` | `public void` | `println(char[] c)`
    `` | `public void` | `println(java.lang.String s)`
    `` | `public void` | `println(java.lang.Object o)`
    `` | `public void` | `println(StreamCharBuffer otherBuffer)`
    `` | `public boolean` | `resetUsed()`
    `` | `public void` | `setError()`
    `` | `public void` | `setMetaClass(groovy.lang.MetaClass metaClass)`
    `` | `public void` | `setOut(java.io.Writer newOut)`
    `` | `public void` | `setProperty(java.lang.String property, java.lang.Object newValue)`
    `` | `public void` | `setUsed(boolean newUsed)`
    `` | `public java.io.Writer` | `unwrap()`
    `` | `protected java.io.Writer` | `unwrapWriter(java.io.Writer writer)`
    `` | `public void` | `write(java.lang.String s)` Writes a string.
    `` | `public void` | `write(int c)` Write a single character.
    `` | `public void` | `write(char[] buf, int off, int len)` Write a portion of an array of characters.
    `` | `public void` | `write(java.lang.String s, int off, int len)` Write a portion of a string.
    `` | `public void` | `write(char[] buf)`
    `` | `public void` | `write(StreamCharBuffer otherBuffer)`
    `` | `public void` | `write(groovy.lang.Writable writable)`
    `` | `protected void` | `writeWritable(groovy.lang.Writable writable)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class java.io.Writer` | `java.io.Writer#append(java.lang.CharSequence, int, int), java.io.Writer#append(java.lang.CharSequence, int, int), java.io.Writer#append(char), java.io.Writer#append(char), java.io.Writer#append(java.lang.CharSequence), java.io.Writer#append(java.lang.CharSequence), java.io.Writer#write(int), java.io.Writer#write([C), java.io.Writer#write([C, int, int), java.io.Writer#write(java.lang.String), java.io.Writer#write(java.lang.String, int, int), java.io.Writer#flush(), java.io.Writer#close(), java.io.Writer#nullWriter(), java.io.Writer#wait(long), java.io.Writer#wait(long, int), java.io.Writer#wait(), java.io.Writer#equals(java.lang.Object), java.io.Writer#toString(), java.io.Writer#hashCode(), java.io.Writer#getClass(), java.io.Writer#notify(), java.io.Writer#notifyAll()`

- - ### Field Detail

    - #### protected static final char[] CRLF

    - #### protected static final org.apache.commons.logging.Log LOG

    - #### protected boolean allowUnwrappingOut

    - #### private groovy.lang.MetaClass metaClass

    - #### protected java.io.Writer out

    - #### protected java.io.Writer previousOut

    - #### protected java.io.Writer streamCharBufferTarget

    - #### protected boolean trouble

    - #### protected boolean usageFlag

  - ### Constructor Detail

    - #### public GrailsPrintWriter(java.io.Writer out)

  - ### Method Detail

    - #### @java.lang.Override public GrailsPrintWriter append(char c)

    - #### @java.lang.Override public GrailsPrintWriter append(java.lang.CharSequence csq, int start, int end)

    - #### @java.lang.Override public GrailsPrintWriter append(java.lang.CharSequence csq)

    - #### public GrailsPrintWriter append(java.lang.Object obj)

    - #### public void append(StreamCharBuffer otherBuffer)

    - #### protected void appendNullCharSequence()

    - #### public java.io.PrintWriter asPrintWriter()

    - #### public java.lang.Object asType(java.lang.Class<?> clazz)

    - #### 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.

    - #### @java.lang.Override protected java.lang.Object clone()

    - #### @java.lang.Override public void close()

    - #### protected java.io.Writer findStreamCharBufferTarget(boolean markUsed)

    - #### @java.lang.Override public void flush()

      Flush the stream.

      See Also:
        checkError()

    - #### public groovy.lang.MetaClass getMetaClass()

    - #### public java.io.Writer getOut()

    - #### public java.lang.Object getProperty(java.lang.String property)

    - #### public java.io.Writer getWriterForEncoder(Encoder encoder, EncodingStateRegistry encodingStateRegistry)

    - #### void handleIOException(java.io.IOException e)

    - #### public java.lang.Object invokeMethod(java.lang.String name, java.lang.Object args)

    - #### public boolean isAllowUnwrappingOut()

    - #### public boolean isDestinationActivated()

    - #### boolean isTrouble()

    - #### public boolean isUsed()

    - #### public GrailsPrintWriter leftShift(java.lang.Object obj)

      Provides Groovy << left shift operator, but intercepts call to make sure nulls are converted to "" strings

      throws:
        IOException
      Parameters:
        `obj` - The value
      Returns:
        Returns this object

    - #### public GrailsPrintWriter leftShift(StreamCharBuffer otherBuffer)

    - #### public GrailsPrintWriter leftShift(groovy.lang.Writable writable)

    - #### public GrailsPrintWriter leftShift(org.codehaus.groovy.runtime.GStringImpl gstring)

    - #### public GrailsPrintWriter leftShift(java.lang.String string)

    - #### public void markUsed()

    - #### public GrailsPrintWriter plus(java.lang.Object value)

    - #### public void print(java.lang.Object obj)

      Print an object. The string produced by the `java.lang.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:
        java.lang.Object#toString()

    - #### 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

    - #### public void print(boolean b)

    - #### public void print(char c)

    - #### public void print(int i)

    - #### public void print(long l)

    - #### public void print(float f)

    - #### public void print(double d)

    - #### public void print(char[] s)

    - #### public void print(StreamCharBuffer otherBuffer)

    - #### public void print(groovy.lang.Writable writable)

    - #### public void print(org.codehaus.groovy.runtime.GStringImpl gstring)

    - #### public void println()

    - #### public void println(boolean b)

    - #### public void println(char c)

    - #### public void println(int i)

    - #### public void println(long l)

    - #### public void println(float f)

    - #### public void println(double d)

    - #### public void println(char[] c)

    - #### public void println(java.lang.String s)

    - #### public void println(java.lang.Object o)

    - #### public void println(StreamCharBuffer otherBuffer)

    - #### public boolean resetUsed()

    - #### public void setError()

    - #### public void setMetaClass(groovy.lang.MetaClass metaClass)

    - #### public void setOut(java.io.Writer newOut)

    - #### public void setProperty(java.lang.String property, java.lang.Object newValue)

    - #### public void setUsed(boolean newUsed)

    - #### public java.io.Writer unwrap()

    - #### protected java.io.Writer unwrapWriter(java.io.Writer writer)

    - #### @java.lang.Override public void write(java.lang.String s)

      Writes a string. If the argument is `null` then the string `""` is printed.

      Parameters:
        `s` - The `String` to be printed

    - #### @java.lang.Override public void write(int c)

      Write a single character.

      Parameters:
        `c` - int specifying a character to be written.

    - #### @java.lang.Override public void write(char[] buf, int off, int len)

      Write a portion of an array of characters.

      Parameters:
        `buf` - Array of characters
        `off` - Offset from which to start writing characters
        `len` - Number of characters to write

    - #### @java.lang.Override public void write(java.lang.String s, int off, int len)

      Write a portion of a string.

      Parameters:
        `s` - A String
        `off` - Offset from which to start writing characters
        `len` - Number of characters to write

    - #### @java.lang.Override public void write(char[] buf)

    - #### public void write(StreamCharBuffer otherBuffer)

    - #### public void write(groovy.lang.Writable writable)

    - #### protected void writeWritable(groovy.lang.Writable writable)