Package java.io

Examples of java.io.PrintWriter.checkError()


        PrintWriter writer = response.getWriter();
        response.setContentLength(0);
        assertTrue(!response.isCommitted());
        assertTrue(!writer.checkError());
        writer.print("");
        assertTrue(!writer.checkError());
        assertTrue(response.isCommitted());
    }

    @Test
    public void testHead() throws Exception
View Full Code Here


                    buf[i]='\n';
            }
            buf[0]='o';
            response.setContentType("text/plain");
            PrintWriter out=response.getWriter();
            while (d > 0 && !out.checkError())
            {
                if (b==1)
                {
                    out.write(d%80==0?'\n':'.');
                    d--;
View Full Code Here

            }
        }
        else if (out instanceof PrintWriter)
        {
            PrintWriter pout=(PrintWriter)out;
            while (!pout.checkError())
            {
                len=in.read(buffer,0,bufferSize);
                if (len==-1)
                    break;
                out.write(buffer,0,len);
View Full Code Here

            // Print the file epilog
            writer.println("</tomcat-users>");

            // Check for errors that occurred while printing
            if (writer.checkError()) {
                writer.close();
                fileNew.delete();
                throw new IOException
                    (sm.getString("memoryUserDatabase.writeException",
                                  fileNew.getAbsolutePath()));
View Full Code Here

            // Print the file epilog
            writer.println("</tomcat-users>");

            // Check for errors that occurred while printing
            if (writer.checkError()) {
                writer.close();
                fileNew.delete();
                throw new IOException
                    (sm.getString("memoryUserDatabase.writeException",
                                  fileNew.getAbsolutePath()));
View Full Code Here

            iterator = inMemoryAppender.iterator(true);
        }

        Layout layout = inMemoryAppender.getLayout();
        PrintWriter w = response.getWriter();
        while (!w.checkError() && iterator.hasNext())
        {
            LoggingEvent e = iterator.next();
            if (e != null)
            {
                w.print(layout.format(e));
View Full Code Here

        mw.close();

        assertOutput("</div></span>");

        assertEquals(false, writer.checkError());

        writer.println();

        assertEquals(true, writer.checkError());
    }
View Full Code Here

        assertEquals(false, writer.checkError());

        writer.println();

        assertEquals(true, writer.checkError());
    }

    public void testComment()
    {
        MarkupFilter filter = newFilter();
View Full Code Here

            // Print the file epilog
            writer.println("</database>");

            // Check for errors that occurred while printing
            if (writer.checkError()) {
                writer.close();
                fileNew.delete();
                throw new IOException
                    ("Saving database to '" + pathname + "'");
            }
View Full Code Here

            // Write the revision number, and end the line.
            out.println(moduleDeclaration.getRevision());
        }

        // Check for errors (which also flushes the stream).
        if (out.checkError()) {
            status.add(new Status(Status.Severity.ERROR, "Error saving workspace declaration."));

        } else {
            // Close the stream.
            out.close();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.