FileDocCategorySizeDatePackage
CoyoteWriter.javaAPI DocGlassfish v2 API8317Fri May 04 22:32:44 BST 2007org.apache.coyote.tomcat5

CoyoteWriter

public class CoyoteWriter extends PrintWriter implements com.sun.enterprise.web.io.ByteWriter
Coyote implementation of the servlet writer.
author
Remy Maucherat
author
Kin-man Chung

Fields Summary
private static final char[]
LINE_SEP
private static final org.apache.catalina.util.StringManager
sm
The string manager for this package.
protected OutputBuffer
ob
protected boolean
error
Constructors Summary
public CoyoteWriter(OutputBuffer ob)



    // ----------------------------------------------------------- Constructors


       
        super(ob);
        this.ob = ob;
    
Methods Summary
public booleancheckError()

        // Disallow operation if the object has gone out of scope
        if (ob == null) {
            throw new IllegalStateException(
                sm.getString("object.invalidScope"));
        }
        flush();
        return error;
    
voidclear()
Clear facade.

        ob = null;
    
protected java.lang.Objectclone()
Prevent cloning the facade.

        throw new CloneNotSupportedException();
    
public voidclose()


        // Disallow operation if the object has gone out of scope
        if (ob == null) {
            throw new IllegalStateException(
                sm.getString("object.invalidScope"));
        }

        // We don't close the PrintWriter - super() is not called,
        // so the stream can be reused. We close ob.
        try {
            ob.close();
        } catch (IOException ex ) {
            ;
        }
        error = false;

    
public voidflush()


        // Disallow operation if the object has gone out of scope
        if (ob == null) {
            throw new IllegalStateException(
                sm.getString("object.invalidScope"));
        }

        if (error)
            return;

        try {
            ob.flush();
        } catch (IOException e) {
            error = true;
        }

    
public voidprint(boolean b)

        if (b) {
            write("true");
        } else {
            write("false");
        }
    
public voidprint(char c)

        write(c);
    
public voidprint(int i)

        write(String.valueOf(i));
    
public voidprint(long l)

        write(String.valueOf(l));
    
public voidprint(float f)

        write(String.valueOf(f));
    
public voidprint(double d)

        write(String.valueOf(d));
    
public voidprint(char[] s)

        write(s);
    
public voidprint(java.lang.String s)

        if (s == null) {
            s = "null";
        }
        write(s);
    
public voidprint(java.lang.Object obj)

        write(String.valueOf(obj));
    
public voidprintln()

        write(LINE_SEP);
    
public voidprintln(boolean b)

        print(b);
        println();
    
public voidprintln(char c)

        print(c);
        println();
    
public voidprintln(int i)

        print(i);
        println();
    
public voidprintln(long l)

        print(l);
        println();
    
public voidprintln(float f)

        print(f);
        println();
    
public voidprintln(double d)

        print(d);
        println();
    
public voidprintln(char[] c)

        print(c);
        println();
    
public voidprintln(java.lang.String s)

        print(s);
        println();
    
public voidprintln(java.lang.Object o)

        print(o);
        println();
    
voidrecycle()
Recycle.

        error = false;
    
public voidwrite(char[] buf)

	write(buf, 0, buf.length);
    
public voidwrite(java.lang.String s, int off, int len)


        // Disallow operation if the object has gone out of scope
        if (ob == null) {
            throw new IllegalStateException(
                sm.getString("object.invalidScope"));
        }

        if (error)
            return;

        try {
            ob.write(s, off, len);
        } catch (IOException e) {
            error = true;
        }

    
public voidwrite(java.lang.String s)

        write(s, 0, s.length());
    
public voidwrite(byte[] buff, int off, int len, int strlen)


        // Disallow operation if the object has gone out of scope
        if (ob == null) {
            throw new IllegalStateException(
                sm.getString("object.invalidScope"));
        }

        if (error)
            return;

        try {
            ob.write(buff, off, len);
        } catch (IOException e) {
            error = true;
        }
    
public voidwrite(int c)


        // Disallow operation if the object has gone out of scope
        if (ob == null) {
            throw new IllegalStateException(
                sm.getString("object.invalidScope"));
        }

        if (error)
            return;

        try {
            ob.write(c);
        } catch (IOException e) {
            error = true;
        }

    
public voidwrite(char[] buf, int off, int len)


        // Disallow operation if the object has gone out of scope
        if (ob == null) {
            throw new IllegalStateException(
                sm.getString("object.invalidScope"));
        }

        if (error)
            return;

        try {
            ob.write(buf, off, len);
        } catch (IOException e) {
            error = true;
        }