Java 8 LineNumberInputStream - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 LineNumberInputStream class.

This code example shows how to use the following methods: getLineNumber, mark, read, reset, skip
 
    /** 
     * @tests java.io.LineNumberInputStream#mark(int) 
     */ 
    public void test_markI() throws IOException { 
        lnis.mark(40);
        lnis.skip(4);
        lnis.reset();
        assertEquals("Failed to mark", 0, lnis.getLineNumber());
        assertEquals("Failed to mark", '0', lnis.read());
    } 
 
    /** 
     * @tests java.io.LineNumberInputStream#read() 
     */ 
    public void test_read() throws IOException { 
        assertEquals("Failed to read correct byte", '0', lnis.read());
        assertEquals("Failed to read correct byte on dos text", '0', lnis2
                .read());
        assertTrue("Failed to read correct byte on dos text",
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: close, getLineNumber, mark, read, reset
            // Expected. 
        } 
    } 
 
    public void test_reset() throws IOException {
        lnis.mark(40);
        lnis.skip(4);
        lnis.reset();
        assertEquals("Test 1: Failed to reset", 0, lnis.getLineNumber());
        assertEquals("Test 2: Failed to reset", '0', lnis.read());
        lnis.reset();
 
        try { 
            lnis.mark(5);
            lnis.skip(100);
            lnis.reset();
            fail("Test 3: Failed to invalidate mark.");
        } catch (IOException e) {
            // Correct; mark has been invalidated. 
        } 

6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: close, getLineNumber, mark, read, reset
            // Expected. 
        } 
    } 
 
    public void test_reset() throws IOException { 
        lnis.mark(40);
        lnis.skip(4);
        lnis.reset();
        assertEquals("Test 1: Failed to reset", 0, lnis.getLineNumber());
        assertEquals("Test 2: Failed to reset", '0', lnis.read());
        lnis.reset();
 
        try { 
            lnis.mark(5);
            lnis.skip(100);
            lnis.reset();
            fail("Test 3: Failed to invalidate mark.");
        } catch (IOException e) {
            // Correct; mark has been invalidated. 
        } 

5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
        } catch (NullPointerException expected) {
        } 
    } 
 
    public void testLineNumberInputStream() throws IOException { 
        assertReadsFailWithNullPointerException(new LineNumberInputStream(null));
    } 
 
    public void testPushbackInputStream() throws IOException { 
        assertReadsFailWithIoException(new PushbackInputStream(null));
        assertReadsFailWithIoException(new PushbackInputStream(null, 1024));
    } 
 
    private void assertReadsFailWithIoException(InputStream in) throws IOException {
        try { 
            in.read();
            fail();
        } catch (IOException expected) {
        } 
 
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
See Code Examples for Java 8 LineNumberInputStream Methods: