Package java.io

Examples of java.io.ByteArrayOutputStream.reset()


                    break;
                default:
                    if (seenCR) {
                        seenCR = false; // swallow final CR
                        listener.handle(new String(lineBuf.toByteArray(), cset));
                        lineBuf.reset();
                        rePos = pos + i + 1;
                    }
                    lineBuf.write(ch);
                }
            }
View Full Code Here


      // @see http://www.libpng.org/pub/png/spec/1.2/PNG-Chunks.html#C.Summary-of-standard-chunks
      String lastChunkType = "";

      while (!hasSeenIEND) {
        boolean skip = false;
        baos.reset();
        String chunkTypeString = null;
        // Length of the chunk
        byte[] lengthBytes = new byte[4];
        try {
          dis.readFully(lengthBytes);
View Full Code Here

        assertEquals("parse() method did not produce the correct log output: ", "<<< STARTED", handler.messages.get(2).getMessage());

        // ENV
        in = new ByteArrayInputStream("ENV test1 test2".getBytes());
        instance.setIn(in);
        bao.reset();
        handler.messages.clear();

        instance.parse(listener);

        Map<String,String> env = getPrivateField(instance, JsvManager.class, "environment");
View Full Code Here

        assertEquals("parse() method did not produce the correct log output: ", ">>> ENV test1 test2", handler.messages.get(0).getMessage());

        // PARAM
        in = new ByteArrayInputStream("PARAM CLIENT test".getBytes());
        instance.setIn(in);
        bao.reset();
        handler.messages.clear();

        instance.parse(listener);

        JobDescription params = getPrivateField(instance, JsvManager.class, "parameters");
View Full Code Here

        assertEquals("parse() method did not produce the correct log output: ", ">>> PARAM CLIENT test", handler.messages.get(0).getMessage());

        // SHOW
        in = new ByteArrayInputStream("SHOW".getBytes());
        instance.setIn(in);
        bao.reset();
        handler.messages.clear();

        instance.parse(listener);

        assertEquals("parse() method produced incorrect output for SHOW command", "LOG INFO got param: CLIENT='test'\nLOG INFO got env: test1='test2'\n", bao.toString());
View Full Code Here

        assertEquals("parse() method did not produce the correct log output: ", "<<< LOG INFO got env: test1='test2'", handler.messages.get(2).getMessage());

        // BEGIN
        in = new ByteArrayInputStream("BEGIN".getBytes());
        instance.setIn(in);
        bao.reset();
        handler.messages.clear();

        instance.parse(listener);

        params = getPrivateField(instance, JsvManager.class, "parameters");
View Full Code Here

        assertEquals("parse() method did not produce the correct log output: ", "<<< RESULT STATE CORRECT modify", handler.messages.get(3).getMessage());

        // QUIT
        in = new ByteArrayInputStream("QUIT".getBytes());
        instance.setIn(in);
        bao.reset();
        handler.messages.clear();

        instance.parse(listener);
        assertEquals("parse() method did not produce the correct log output: ", 1, handler.messages.size());
        assertEquals("parse() method did not produce the correct log output: ", Level.FINE, handler.messages.get(0).getLevel());
View Full Code Here

        assertEquals("parse() method did not produce the correct log output: ", Level.FINE, handler.messages.get(0).getLevel());
        assertEquals("parse() method did not produce the correct log output: ", ">>> QUIT", handler.messages.get(0).getMessage());
       
        in = new ByteArrayInputStream("START\nBEGIN\nQUIT\n".getBytes());
        instance.setIn(in);
        bao.reset();
        handler.messages.clear();

        instance.parse(null);

        assertEquals("parse() method produced unexpected output: ", "STARTED\nRESULT STATE ACCEPT\n", bao.toString());
View Full Code Here

        assertEquals("parse() method did not produce the correct log output: ", Level.FINE, handler.messages.get(4).getLevel());
        assertEquals("parse() method did not produce the correct log output: ", ">>> QUIT", handler.messages.get(4).getMessage());

        in = new ByteArrayInputStream("NONSENSE\n".getBytes());
        instance.setIn(in);
        bao.reset();
        handler.messages.clear();

        instance.parse(null);

        assertEquals("parse() sent output even though it recieved bad input: ", "", bao.toString());
View Full Code Here

        assertEquals("parse() method did not produce the correct log output: ", ">>> NONSENSE", handler.messages.get(0).getMessage());
        assertEquals("parse() did not log an appropriate log message: ", Level.WARNING, handler.messages.get(1).getLevel());

        in = new ByteArrayInputStream("\n".getBytes());
        instance.setIn(in);
        bao.reset();
        handler.messages.clear();

        instance.parse(null);

        assertEquals("parse() sent output even though it recieved bad input: ", "", bao.toString());
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.