## org.codehaus.groovy.grails.web.util
Class GrailsPrintWriter

    java.lang.Object
      java.io.Writer
          java.io.PrintWriter
              org.codehaus.groovy.grails.web.util.GrailsPrintWriter

All Implemented Interfaces:
  Closeable, Flushable, Appendable

Direct Known Subclasses:
  FastStringWriter, GrailsRoutablePrintWriter, GSPResponseWriter

    public class GrailsPrintWriter

extends PrintWriter

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

Author:
  Lari Hotari, Sagire Software Oy

Field Summary
`protected boolean` `allowUnwrappingOut`
`protected Writer` `out`
`protected boolean` `trouble`

Fields inherited from class java.io.Writer
`lock`

Constructor Summary
`GrailsPrintWriter(Writer out)`

Method Summary
`PrintWriter` `append(char c)`
`PrintWriter` `append(CharSequence csq)`
`PrintWriter` `append(CharSequence csq, int start, int end)`
`GrailsPrintWriter` `append(Object obj)`
`void` `append(StreamCharBuffer otherBuffer)`
`boolean` `checkError()` Flush the stream if it's not closed and check its error state.
`protected Object` `clone()`
`void` `flush()` Flush the stream.
`Writer` `getFinalTarget()`
`Writer` `getOut()`
`protected void` `handleIOException(IOException e)`
`boolean` `isAllowUnwrappingOut()`
`boolean` `isFinalTargetHere()`
`boolean` `isUsed()`
`GrailsPrintWriter` `leftShift(Object value)` Provides Groovy << left shift operator, but intercepts call to make sure nulls are converted to "" strings
`GrailsPrintWriter` `leftShift(StreamCharBuffer otherBuffer)`
`GrailsPrintWriter` `leftShift(groovy.lang.Writable writable)`
`GrailsPrintWriter` `plus(Object value)`
`void` `print(boolean b)` delegate methods, not synchronized
`void` `print(char c)`
`void` `print(char[] s)`
`void` `print(double d)`
`void` `print(float f)`
`void` `print(int i)`
`void` `print(long l)`
`void` `print(Object obj)` Print an object.
`void` `print(StreamCharBuffer otherBuffer)`
`void` `print(String s)` Print a string.
`void` `print(groovy.lang.Writable writable)`
`void` `println()`
`void` `println(boolean b)`
`void` `println(char c)`
`void` `println(char[] c)`
`void` `println(double d)`
`void` `println(float f)`
`void` `println(int i)`
`void` `println(long l)`
`void` `println(Object o)`
`void` `println(StreamCharBuffer otherBuffer)`
`void` `println(String s)`
`boolean` `resetUsed()`
`void` `setFinalTargetHere(boolean finalTargetHere)`
`void` `setUsed(boolean newUsed)`
`void` `write(char[] buf)`
`void` `write(char[] buf, int off, int len)` Write a portion of an array of characters.
`void` `write(int c)` Write a single character.
`void` `write(StreamCharBuffer otherBuffer)`
`void` `write(String s)` Writes a string.
`void` `write(String s, int off, int len)` Write a portion of a string.
`void` `write(groovy.lang.Writable writable)`

Methods inherited from class java.io.PrintWriter
`close, format, format, printf, printf, setError`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### trouble

    protected boolean trouble

### out

    protected Writer out

### allowUnwrappingOut

    protected boolean allowUnwrappingOut

Constructor Detail

### GrailsPrintWriter

    public GrailsPrintWriter(Writer out)

Method Detail

### isAllowUnwrappingOut

    public boolean isAllowUnwrappingOut()

### getOut

    public Writer getOut()

### isFinalTargetHere

    public boolean isFinalTargetHere()

### setFinalTargetHere

    public void setFinalTargetHere(boolean finalTargetHere)

### getFinalTarget

    public Writer getFinalTarget()

### leftShift

    public GrailsPrintWriter leftShift(Object value)
                                throws IOException

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

  Parameters:
    `value` - The value
  Returns:
    Returns this object
  Throws:
    `IOException`

### plus

    public GrailsPrintWriter plus(Object value)
                           throws IOException

  Throws:
    `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.

  Overrides:
    `checkError` in class `PrintWriter`
  Returns:
    True if the print stream has encountered an error, either on the underlying output stream or during a format conversion.

### flush

    public void flush()

  Flush the stream.

  Specified by:
    `flush` in interface `Flushable`
  Overrides:
    `flush` in class `PrintWriter`
  See Also:
    `checkError()`

### handleIOException

    protected void handleIOException(IOException e)

### print

    public void print(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.

  Overrides:
    `print` in class `PrintWriter`
  Parameters:
    `obj` - The `Object` to be printed
  See Also:
    `Object.toString()`

### print

    public void print(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.

  Overrides:
    `print` in class `PrintWriter`
  Parameters:
    `s` - The `String` to be printed

### write

    public void write(String s)

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

  Overrides:
    `write` in class `PrintWriter`
  Parameters:
    `s` - The `String` to be printed

### write

    public void write(int c)

  Write a single character.

  Overrides:
    `write` in class `PrintWriter`
  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.

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

### write

    public void write(String s,
                      int off,
                      int len)

  Write a portion of a string.

  Overrides:
    `write` in class `PrintWriter`
  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 `PrintWriter`

### print

    public void print(boolean b)

  delegate methods, not synchronized

  Overrides:
    `print` in class `PrintWriter`

### print

    public void print(char c)

  Overrides:
    `print` in class `PrintWriter`

### print

    public void print(int i)

  Overrides:
    `print` in class `PrintWriter`

### print

    public void print(long l)

  Overrides:
    `print` in class `PrintWriter`

### print

    public void print(float f)

  Overrides:
    `print` in class `PrintWriter`

### print

    public void print(double d)

  Overrides:
    `print` in class `PrintWriter`

### print

    public void print(char[] s)

  Overrides:
    `print` in class `PrintWriter`

### println

    public void println()

  Overrides:
    `println` in class `PrintWriter`

### println

    public void println(boolean b)

  Overrides:
    `println` in class `PrintWriter`

### println

    public void println(char c)

  Overrides:
    `println` in class `PrintWriter`

### println

    public void println(int i)

  Overrides:
    `println` in class `PrintWriter`

### println

    public void println(long l)

  Overrides:
    `println` in class `PrintWriter`

### println

    public void println(float f)

  Overrides:
    `println` in class `PrintWriter`

### println

    public void println(double d)

  Overrides:
    `println` in class `PrintWriter`

### println

    public void println(char[] c)

  Overrides:
    `println` in class `PrintWriter`

### println

    public void println(String s)

  Overrides:
    `println` in class `PrintWriter`

### println

    public void println(Object o)

  Overrides:
    `println` in class `PrintWriter`

### append

    public PrintWriter append(char c)

  Specified by:
    `append` in interface `Appendable`
  Overrides:
    `append` in class `PrintWriter`

### append

    public PrintWriter append(CharSequence csq,
                              int start,
                              int end)

  Specified by:
    `append` in interface `Appendable`
  Overrides:
    `append` in class `PrintWriter`

### append

    public PrintWriter append(CharSequence csq)

  Specified by:
    `append` in interface `Appendable`
  Overrides:
    `append` in class `PrintWriter`

### append

    public GrailsPrintWriter append(Object obj)

### clone

    protected Object clone()
                    throws CloneNotSupportedException

  Overrides:
    `clone` in class `Object`
  Throws:
    `CloneNotSupportedException`

### write

    public void write(StreamCharBuffer otherBuffer)

### print

    public void print(StreamCharBuffer otherBuffer)

### append

    public void append(StreamCharBuffer otherBuffer)

### println

    public void println(StreamCharBuffer otherBuffer)

### leftShift

    public GrailsPrintWriter leftShift(StreamCharBuffer otherBuffer)

### write

    public void write(groovy.lang.Writable writable)

### print

    public void print(groovy.lang.Writable writable)

### leftShift

    public GrailsPrintWriter leftShift(groovy.lang.Writable writable)

### isUsed

    public boolean isUsed()

### setUsed

    public void setUsed(boolean newUsed)

### resetUsed

    public boolean resetUsed()

Copyright (c) 2005-2009 The Grails project