Examples of PipedWriter


Examples of java.io.PipedWriter

     * @tests java.io.PipedWriter#write(int)
     */
    public void test_writeI() throws Exception {
        // Test for method void java.io.PipedWriter.write(int)

        pw = new PipedWriter();
        rdrThread = new Thread(reader = new PReader(pw), "writeI");
        rdrThread.start();
        pw.write(1);
        pw.write(2);
        pw.write(3);
View Full Code Here

Examples of java.io.PipedWriter

            int scriptIndex = 0;

            if (sqlText != null) {
                try {
                    tmpReader = new PipedReader();
                    PipedWriter tmpWriter = new PipedWriter(tmpReader);
                    // My best guess is that the encoding here will be however
                    // we read the SQL text from the command-line, which will
                    // be the platform default encoding.  Therefore, don't
                    // specify an encoding for this pipe.
                    try {
                        tmpWriter.write(sqlText + LS);
                        tmpWriter.flush();
                    } finally {
                        try {
                            tmpWriter.close();
                        } finally {
                            tmpWriter = null// Encourage GC of buffers
                        }
                    }
                } catch (IOException ioe) {
View Full Code Here

Examples of java.io.PipedWriter

     */
    public static ClaimStatistic report(Writer out, IReportable base, final InputStream style,
            ReportConfiguration pConfiguration)
    throws IOException, TransformerConfigurationException, FileNotFoundException, InterruptedException, RatException {
        PipedReader reader = new PipedReader();
        PipedWriter writer = new PipedWriter(reader);
        ReportTransformer transformer = new ReportTransformer(out, style, reader);
        Thread transformerThread = new Thread(transformer);
        transformerThread.start();
        final ClaimStatistic statistic = report(base, writer, pConfiguration);
        writer.flush();
        writer.close();
        transformerThread.join();
        return statistic;
    }
View Full Code Here

Examples of java.io.PipedWriter

     * @throws IOException if an IO error occurs
     */
    public Reader getReader() throws IOException {
        if (this.pipeIn == null) {
            this.pipeIn = new PipedReader();
            this.pipeOut = new PipedWriter(this.pipeIn);

            Thread thread = new ParserThread(this);
            thread.start(); // start parsing
        }

View Full Code Here

Examples of java.io.PipedWriter

    private BufferedReader getReader(String id) throws CGateException
    {
        try
        {
            PipedWriter piped_writer = new PipedWriter();
            BufferedWriter out = new BufferedWriter(piped_writer);
            response_writers.put(id, out);

            PipedReader piped_reader = new PipedReader(piped_writer);
            return new BufferedReader(piped_reader);
View Full Code Here

Examples of java.io.PipedWriter

     * @throws IOException DOCUMENT ME!
     */
    public Reader getReader() throws IOException {
        if (pipeIn == null) {
            pipeIn = new PipedReader();
            pipeOut = new PipedWriter(pipeIn);

            Thread thread = new ParserThread(this);
            thread.start(); // start parsing
        }

View Full Code Here

Examples of java.io.PipedWriter

    /**
     * @tests java.io.PipedWriter#write(char[], int, int)
     */
    public void test_write$CII_4() throws IOException {
        PipedReader pr = new PipedReader();
        PipedWriter obj = null;
        try {
            obj = new java.io.PipedWriter(pr);
            obj.write(new char[0], (int) -1, (int) -1);
            fail("IndexOutOfBoundsException expected");
        } catch (ArrayIndexOutOfBoundsException t) {
            fail("IndexOutOfBoundsException expected");
        } catch (IndexOutOfBoundsException t) {}
    }
View Full Code Here

Examples of java.io.PipedWriter

    /**
     * @tests java.io.PipedWriter#write(char[], int, int)
     */
    public void test_write$CII_5() throws IOException {
        PipedReader pr = new PipedReader();
        PipedWriter obj = null;
        try {
            obj = new PipedWriter(pr);
            obj.write((char[]) null, (int) -1, (int) 0);
            fail("NullPointerException expected");
        } catch (IndexOutOfBoundsException t) {
            fail("NullPointerException expected");
        } catch (NullPointerException t) {}
    }
View Full Code Here

Examples of java.io.PipedWriter

    /**
     * @tests java.io.PipedWriter#write(char[], int, int)
     */
    public void test_write$CII_6() throws IOException {
        PipedReader pr = new PipedReader();
        PipedWriter obj = null;
        try {
            obj = new PipedWriter(pr);
            obj.write((char[]) null, (int) -1, (int) -1);
            fail("NullPointerException expected");
        } catch (IndexOutOfBoundsException t) {
            fail("NullPointerException expected");
        } catch (NullPointerException t) {}
    }
View Full Code Here

Examples of java.io.PipedWriter

     * @tests java.io.PipedWriter#write(char[], int, int)
     */
    public void test_write$CII_notConnected() throws IOException {
        // Regression test for Harmony-2404
        // create not connected pipe
        PipedWriter obj = new PipedWriter();

        // char array is null
        try {
            obj.write((char[]) null, 0, 1);
            fail("IOException expected");
        } catch (IOException ioe) {
            // expected
        }

        // negative offset
        try {
            obj.write( new char[] { 1 }, -10, 1);
            fail("IOException expected");
        } catch (IOException ioe) {
            // expected
        }

        // wrong offset
        try {
            obj.write( new char[] { 1 }, 10, 1);
            fail("IOException expected");
        } catch (IOException ioe) {
            // expected
        }

        // negative length
        try {
            obj.write( new char[] { 1 }, 0, -10);
            fail("IOException expected");
        } catch (IOException ioe) {
            // expected
        }

        // all valid params
        try {
            obj.write( new char[] { 1, 1 }, 0, 1);
            fail("IOException expected");
        } catch (IOException ioe) {
            // expected
        }
    }
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.