Java Code Examples for java.io.CharArrayReader#skip()

The following examples show how to use java.io.CharArrayReader#skip() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OldCharArrayReaderTest.java    From j2objc with Apache License 2.0 6 votes vote down vote up
/**
 * java.io.CharArrayReader#mark(int)
 */
public void test_markI() throws IOException {
    cr = new CharArrayReader(hw);
    cr.skip(5L);
    cr.mark(100);
    cr.read();
    cr.reset();
    assertEquals("Test 1: Failed to mark correct position;",
            'W', cr.read());

    cr.close();
    try {
        cr.mark(100);
        fail("Test 2: IOException expected.");
    } catch (IOException e) {
        // Expected.
    }
}
 
Example 2
Source File: OldCharArrayReaderTest.java    From j2objc with Apache License 2.0 6 votes vote down vote up
/**
 * java.io.CharArrayReader#reset()
 */
public void test_reset() throws IOException {
    cr = new CharArrayReader(hw);
    cr.skip(5L);
    cr.mark(100);
    cr.read();
    cr.reset();
    assertEquals("Test 1: Reset failed to return to marker position.",
            'W', cr.read());

    cr.close();
    try {
        cr.reset();
        fail("Test 2: IOException expected.");
    } catch (IOException e) {
        // Expected.
    }
}
 
Example 3
Source File: OldCharArrayReaderTest.java    From j2objc with Apache License 2.0 6 votes vote down vote up
public void test_skipJ() throws IOException {
    long skipped = 0;
    cr = new CharArrayReader(hw);
    skipped = cr.skip(5L);
    assertEquals("Test 1: Failed to skip correct number of chars;",
            5L, skipped);
    assertEquals("Test 2: Skip skipped wrong chars;",
            'W', cr.read());

    cr.close();
    try {
        cr.skip(1);
        fail("Test 3: IOException expected.");
    } catch (IOException e) {
        // Expected.
    }
}