Package org.grails.buffer
Class GrailsPrintWriter
java.lang.Object
java.io.Writer
org.grails.buffer.GrailsPrintWriter
- All Implemented Interfaces:
groovy.lang.GroovyObject,Closeable,Flushable,Appendable,AutoCloseable,GrailsWrappedWriter,EncodedAppenderWriterFactory
- Direct Known Subclasses:
CodecPrintWriter,FastStringWriter,GrailsLazyProxyPrintWriter
public class GrailsPrintWriter
extends Writer
implements GrailsWrappedWriter, EncodedAppenderWriterFactory, groovy.lang.GroovyObject
PrintWriter implementation that doesn't have synchronization. null object
references are ignored in print methods (nothing gets printed)
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionappend(char c) append(CharSequence csq) append(CharSequence csq, int start, int end) voidappend(StreamCharBuffer otherBuffer) protected voidbooleanFlush the stream if it's not closed and check its error state.protected Objectclone()voidclose()protected WriterfindStreamCharBufferTarget(boolean markUsed) voidflush()Flush the stream.groovy.lang.MetaClassgetOut()getProperty(String property) getWriterForEncoder(Encoder encoder, EncodingStateRegistry encodingStateRegistry) Gets the EncodedAppenderWriter instance that is connected to this instance implementation with a certain encoder fixed.invokeMethod(String name, Object args) booleanbooleanbooleanisUsed()leftShift(groovy.lang.Writable writable) Provides Groovy << left shift operator, but intercepts call to make sure nulls are converted to "" stringsleftShift(org.codehaus.groovy.runtime.GStringImpl gstring) leftShift(StreamCharBuffer otherBuffer) voidmarkUsed()voidprint(boolean b) delegate methods, not synchronizedvoidprint(char c) voidprint(char[] s) voidprint(double d) voidprint(float f) voidprint(int i) voidprint(long l) voidprint(groovy.lang.Writable writable) voidPrint an object.voidPrint a string.voidprint(org.codehaus.groovy.runtime.GStringImpl gstring) voidprint(StreamCharBuffer otherBuffer) voidprintln()voidprintln(boolean b) voidprintln(char c) voidprintln(char[] c) voidprintln(double d) voidprintln(float f) voidprintln(int i) voidprintln(long l) voidvoidvoidprintln(StreamCharBuffer otherBuffer) booleanvoidsetError()voidsetMetaClass(groovy.lang.MetaClass metaClass) voidvoidsetProperty(String property, Object newValue) voidsetUsed(boolean newUsed) unwrap()protected WriterunwrapWriter(Writer writer) voidwrite(char[] buf) voidwrite(char[] buf, int off, int len) Write a portion of an array of characters.voidwrite(int c) Write a single character.voidwrite(groovy.lang.Writable writable) voidWrites a string.voidWrite a portion of a string.voidwrite(StreamCharBuffer otherBuffer) protected voidwriteWritable(groovy.lang.Writable writable) Methods inherited from class java.io.Writer
nullWriter
-
Field Details
-
logger
protected static final org.apache.commons.logging.Log logger -
CRLF
protected static final char[] CRLF -
trouble
protected boolean trouble -
out
-
allowUnwrappingOut
protected boolean allowUnwrappingOut -
usageFlag
protected boolean usageFlag -
streamCharBufferTarget
-
previousOut
-
-
Constructor Details
-
GrailsPrintWriter
-
-
Method Details
-
isAllowUnwrappingOut
public boolean isAllowUnwrappingOut()- Specified by:
isAllowUnwrappingOutin interfaceGrailsWrappedWriter
-
unwrap
- Specified by:
unwrapin interfaceGrailsWrappedWriter
-
isDestinationActivated
public boolean isDestinationActivated() -
getOut
-
setOut
-
unwrapWriter
-
leftShift
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:
IOException
-
plus
- 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.- 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. -
print
Print an object. The string produced by themethod is translated into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of theString.valueOf(Object)method.write(int)- Parameters:
obj- TheObjectto be printed- See Also:
-
print
Print a string. If the argument isnullthen 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 themethod.write(int)- Parameters:
s- TheStringto be printed
-
write
Writes a string. If the argument isnullthen the string""is printed. -
write
public void write(int c) Write a single character. -
write
public void write(char[] buf, int off, int len) Write a portion of an array of characters. -
write
Write a portion of a string. -
write
public void write(char[] buf) -
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
-
println
-
append
- Specified by:
appendin interfaceAppendable- Overrides:
appendin classWriter
-
append
- Specified by:
appendin interfaceAppendable- Overrides:
appendin classWriter
-
appendNullCharSequence
- Throws:
IOException
-
append
- Specified by:
appendin interfaceAppendable- Overrides:
appendin classWriter
-
append
-
clone
- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-
write
-
findStreamCharBufferTarget
-
print
-
append
-
println
-
leftShift
-
write
public void write(groovy.lang.Writable writable) -
writeWritable
protected void writeWritable(groovy.lang.Writable writable) -
print
public void print(groovy.lang.Writable writable) -
leftShift
-
print
public void print(org.codehaus.groovy.runtime.GStringImpl gstring) -
leftShift
-
leftShift
-
isUsed
public boolean isUsed() -
setUsed
public void setUsed(boolean newUsed) -
resetUsed
public boolean resetUsed() -
close
public void close() -
markUsed
public void markUsed()- Specified by:
markUsedin interfaceGrailsWrappedWriter
-
asType
-
asPrintWriter
-
getWriterForEncoder
Description copied from interface:EncodedAppenderWriterFactoryGets the EncodedAppenderWriter instance that is connected to this instance implementation with a certain encoder fixed.- Specified by:
getWriterForEncoderin interfaceEncodedAppenderWriterFactory- Parameters:
encoder- the encoder to useencodingStateRegistry- the current EncodingStateRegistry to use- Returns:
- the java.io.Writer instance
-
getProperty
- Specified by:
getPropertyin interfacegroovy.lang.GroovyObject
-
setProperty
- Specified by:
setPropertyin interfacegroovy.lang.GroovyObject
-
invokeMethod
- Specified by:
invokeMethodin interfacegroovy.lang.GroovyObject
-
getMetaClass
public groovy.lang.MetaClass getMetaClass()- Specified by:
getMetaClassin interfacegroovy.lang.GroovyObject
-
setMetaClass
public void setMetaClass(groovy.lang.MetaClass metaClass) - Specified by:
setMetaClassin interfacegroovy.lang.GroovyObject
-