Groovy Documentation

org.codehaus.groovy.grails.web.util
[Java] Class GrailsPrintWriter

java.lang.Object
  java.io.Writer
      org.codehaus.groovy.grails.web.util.GrailsPrintWriter
All Implemented Interfaces:
EncodedAppenderWriterFactory, GrailsWrappedWriter, groovy.lang.GroovyObject

public class GrailsPrintWriter
extends java.io.Writer

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
protected static char[] CRLF

protected static org.apache.commons.logging.Log LOG

protected boolean allowUnwrappingOut

protected java.io.Writer out

protected java.io.Writer previousOut

protected java.io.Writer streamCharBufferTarget

protected boolean trouble

protected boolean usageFlag

 
Constructor Summary
GrailsPrintWriter(java.io.Writer out)

 
Method Summary
GrailsPrintWriter append(char c)

GrailsPrintWriter append(java.lang.CharSequence csq, int start, int end)

GrailsPrintWriter append(java.lang.CharSequence csq)

GrailsPrintWriter append(java.lang.Object obj)

void append(StreamCharBuffer otherBuffer)

java.io.PrintWriter asPrintWriter()

java.lang.Object asType(java.lang.Class clazz)

boolean checkError()

Flush the stream if it's not closed and check its error state.

protected java.lang.Object clone()

void close()

protected java.io.Writer findStreamCharBufferTarget(boolean markUsed)

void flush()

Flush the stream.

groovy.lang.MetaClass getMetaClass()

java.io.Writer getOut()

java.lang.Object getProperty(java.lang.String property)

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

java.lang.Object invokeMethod(java.lang.String name, java.lang.Object args)

boolean isAllowUnwrappingOut()

boolean isDestinationActivated()

boolean isUsed()

GrailsPrintWriter leftShift(java.lang.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 leftShift(org.codehaus.groovy.runtime.GStringImpl gstring)

GrailsPrintWriter leftShift(java.lang.String string)

void markUsed()

GrailsPrintWriter plus(java.lang.Object value)

void print(java.lang.Object obj)

Print an object.

void print(java.lang.String s)

Print a string.

void print(boolean b)

delegate methods, not synchronized *

void print(char c)

void print(int i)

void print(long l)

void print(float f)

void print(double d)

void print(char[] s)

void print(StreamCharBuffer otherBuffer)

void print(groovy.lang.Writable writable)

void print(org.codehaus.groovy.runtime.GStringImpl gstring)

void println()

void println(boolean b)

void println(char c)

void println(int i)

void println(long l)

void println(float f)

void println(double d)

void println(char[] c)

void println(java.lang.String s)

void println(java.lang.Object o)

void println(StreamCharBuffer otherBuffer)

boolean resetUsed()

void setError()

void setMetaClass(groovy.lang.MetaClass metaClass)

void setOut(java.io.Writer newOut)

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

void setUsed(boolean newUsed)

java.io.Writer unwrap()

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

void write(java.lang.String s)

Writes a string.

void write(int c)

Write a single character.

void write(char[] buf, int off, int len)

Write a portion of an array of characters.

void write(java.lang.String s, int off, int len)

Write a portion of a string.

void write(char[] buf)

void write(StreamCharBuffer otherBuffer)

void write(groovy.lang.Writable writable)

protected void writeWritable(groovy.lang.Writable writable)

 
Methods inherited from class java.io.Writer
java.io.Writer#append(java.lang.CharSequence, int, int), java.io.Writer#append(char), java.io.Writer#append(java.lang.CharSequence), java.io.Writer#append(char), java.io.Writer#append(java.lang.CharSequence, int, int), java.io.Writer#append(java.lang.CharSequence), java.io.Writer#write([C), java.io.Writer#write([C, int, int), java.io.Writer#write(int), java.io.Writer#write(java.lang.String, int, int), java.io.Writer#write(java.lang.String), java.io.Writer#flush(), java.io.Writer#close(), java.io.Writer#wait(long, int), java.io.Writer#wait(long), 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()
 
Methods inherited from class java.lang.Object
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Field Detail

CRLF

protected static final char[] CRLF


LOG

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


allowUnwrappingOut

protected boolean allowUnwrappingOut


out

protected java.io.Writer out


previousOut

protected java.io.Writer previousOut


streamCharBufferTarget

protected java.io.Writer streamCharBufferTarget


trouble

protected boolean trouble


usageFlag

protected boolean usageFlag


 
Constructor Detail

GrailsPrintWriter

public GrailsPrintWriter(java.io.Writer out)


 
Method Detail

append

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


append

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


append

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


append

public GrailsPrintWriter append(java.lang.Object obj)


append

public void append(StreamCharBuffer otherBuffer)


asPrintWriter

public java.io.PrintWriter asPrintWriter()


asType

public java.lang.Object asType(java.lang.Class clazz)


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.


clone

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


close

@java.lang.Override
public void close()


findStreamCharBufferTarget

protected java.io.Writer findStreamCharBufferTarget(boolean markUsed)


flush

@java.lang.Override
public void flush()
Flush the stream.
See Also:
checkError()


getMetaClass

public groovy.lang.MetaClass getMetaClass()


getOut

public java.io.Writer getOut()


getProperty

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


getWriterForEncoder

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


invokeMethod

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


isAllowUnwrappingOut

public boolean isAllowUnwrappingOut()


isDestinationActivated

public boolean isDestinationActivated()


isUsed

public boolean isUsed()


leftShift

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


leftShift

public GrailsPrintWriter leftShift(StreamCharBuffer otherBuffer)


leftShift

public GrailsPrintWriter leftShift(groovy.lang.Writable writable)


leftShift

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


leftShift

public GrailsPrintWriter leftShift(java.lang.String string)


markUsed

public void markUsed()


plus

public GrailsPrintWriter plus(java.lang.Object value)


print

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()


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


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)


print

public void print(StreamCharBuffer otherBuffer)


print

public void print(groovy.lang.Writable writable)


print

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


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)


println

public void println(StreamCharBuffer otherBuffer)


resetUsed

public boolean resetUsed()


setError

public void setError()


setMetaClass

public void setMetaClass(groovy.lang.MetaClass metaClass)


setOut

public void setOut(java.io.Writer newOut)


setProperty

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


setUsed

public void setUsed(boolean newUsed)


unwrap

public java.io.Writer unwrap()


unwrapWriter

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


write

@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


write

@java.lang.Override
public void write(int c)
Write a single character.
Parameters:
c - int specifying a character to be written.


write

@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


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


write

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


write

public void write(StreamCharBuffer otherBuffer)


write

public void write(groovy.lang.Writable writable)


writeWritable

protected void writeWritable(groovy.lang.Writable writable)


 

Groovy Documentation