Examples of UnclosableOutputStream


Examples of org.restlet.engine.io.UnclosableOutputStream

        assertTrue(stream.closed);
    }

    public void testWrite() throws IOException {
        final ByteArrayOutputStream stream = new ByteArrayOutputStream();
        final OutputStream out = new UnclosableOutputStream(stream);

        out.write('a');
        assertEquals("a", new String(stream.toByteArray()));

        out.write(new byte[] { 'b', 'c' });
        assertEquals("abc", new String(stream.toByteArray()));

        out.write(new byte[] { 'd', 'e', 'f', 'g' }, 0, 2);
        assertEquals("abcde", new String(stream.toByteArray()));
    }
View Full Code Here

Examples of org.restlet.engine.io.UnclosableOutputStream

        }
    }

    public void testClose() throws IOException {
        final MockOutputStream stream = new MockOutputStream();
        final OutputStream out = new UnclosableOutputStream(stream);
        out.close();

        assertFalse(stream.closed);
        stream.close();
        assertTrue(stream.closed);
    }
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.