Package org.jruby.embed.io

Examples of org.jruby.embed.io.ReaderInputStream


     * Test of available method, of class ReaderInputStream.
     */
    @Test
    public void testAvailable() throws Exception {
        logger1.info("available");
        ReaderInputStream instance = new ReaderInputStream(new FileReader(filename));
        int expResult = 40;
        int result = instance.available();
        assertEquals(expResult, result);
        instance.close();
    }
View Full Code Here


     * Test of close method, of class ReaderInputStream.
     */
    @Test
    public void testClose() throws Exception {
        logger1.info("close");
        ReaderInputStream instance = new ReaderInputStream(new FileReader(filename2));
        instance.close();
    }
View Full Code Here

     * Test of mark method, of class ReaderInputStream.
     */
    @Test
    public void testMark() throws IOException {
        logger1.info("mark");
        ReaderInputStream instance = new ReaderInputStream(new FileReader(filename));
        int readlimit = 0;
        instance.mark(readlimit);
        instance.close();
    }
View Full Code Here

     * Test of markSupported method, of class ReaderInputStream.
     */
    @Test
    public void testMarkSupported() throws IOException {
        logger1.info("markSupported");
        ReaderInputStream instance = new ReaderInputStream(new FileReader(filename));
        boolean expResult = true;
        boolean result = instance.markSupported();
        assertEquals(expResult, result);
        instance.close();
    }
View Full Code Here

     * Test of read method, of class ReaderInputStream.
     */
    @Test
    public void testRead_0args() throws IOException {
        logger1.info("read 0args");
        ReaderInputStream instance = new ReaderInputStream(new FileReader(filename));
        int expResult = 0x70// is 'p' by UTF-8
        int result = instance.read();
        assertEquals(expResult, result);
        instance.close();
    }
View Full Code Here

     * Test of read method, of class ReaderInputStream.
     */
    @Test
    public void testRead_byteArr() throws IOException {
        logger1.info("read byteArr");
        ReaderInputStream instance = new ReaderInputStream(new FileReader(filename));
        byte[] b = new byte[4];
        int expResult = 4;
        int result = instance.read(b);
        assertEquals(expResult, result);
        assertEquals(0x70, b[0]);
        instance.close();
    }
View Full Code Here

     * Test of read method, of class ReaderInputStream.
     */
    @Test
    public void testRead_3args() throws IOException {
        logger1.info("read 3args");
        ReaderInputStream instance = new ReaderInputStream(new FileReader(filename));
        byte[] b = new byte[15];
        int off = 6;
        int len = b.length;
        int expResult = 15;
        int result = instance.read(b, off, len);
        assertEquals(expResult, result);
        instance.close();
    }
View Full Code Here

     */
    @Test
    public void testRead_3args_bigfile() throws Exception {
        logger1.info("read 3args big file");
        StringBuffer sb = new StringBuffer();
        ReaderInputStream instance = new ReaderInputStream(new FileReader(filename2));
        while (instance.available() > 0) {
            byte[] buf = new byte[1024];
            int size = instance.read(buf, 0, buf.length);
            if (size != -1) {
                sb.append(new String(buf));
            }
        }
        instance.close();
        String[] paths = {
            basedir + "/lib/ruby/1.8",
            basedir + "/lib/ruby/1.8/rdoc",
            basedir + "/lib/ruby/site_ruby/1.8",
            basedir + "/lib/ruby/site_ruby/shared",
View Full Code Here

     * Test of reset method, of class ReaderInputStream.
     */
    @Test
    public void testReset() throws Exception {
        logger1.info("reset");
        ReaderInputStream instance = new ReaderInputStream(new FileReader(filename));
        int readlimit = 0;
        instance.mark(readlimit);
        instance.reset();
        instance.close();
    }
View Full Code Here

     * Test of skip method, of class ReaderInputStream.
     */
    @Test
    public void testSkip() throws Exception {
        logger1.info("skip");
        ReaderInputStream instance = new ReaderInputStream(new FileReader(filename));
        long n = 0L;
        long expResult = 0L;
        long result = instance.skip(n);
        assertEquals(expResult, result);
        instance.close();
    }
View Full Code Here

TOP

Related Classes of org.jruby.embed.io.ReaderInputStream

Copyright © 2018 www.massapicom. 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.