Package java.nio.charset

Examples of java.nio.charset.UnmappableCharacterException


                decoder.reset();
            }
            if (result.isMalformed()) {
                throw new MalformedInputException(result.length());
            } else if (result.isUnmappable()) {
                throw new UnmappableCharacterException(result.length());
            }

            return out.position() - offset == 0 ? -1 : out.position() - offset;
        }
    }
View Full Code Here


                decoder.reset();
            }
            if (result.isMalformed()) {
                throw new MalformedInputException(result.length());
            } else if (result.isUnmappable()) {
                throw new UnmappableCharacterException(result.length());
            }

            return out.position() - offset == 0 ? -1 : out.position() - offset;
        }
    }
View Full Code Here

                decoder.reset();
            }
            if (result.isMalformed()) {
                throw new MalformedInputException(result.length());
            } else if (result.isUnmappable()) {
                throw new UnmappableCharacterException(result.length());
            }
            if (result == CoderResult.OVERFLOW && bytes.position() != 0) {
                bytes.flip();
            }
View Full Code Here

                decoder.reset();
            }
            if (result.isMalformed()) {
                throw new MalformedInputException(result.length());
            } else if (result.isUnmappable()) {
                throw new UnmappableCharacterException(result.length());
            }

            return out.position() - offset == 0 ? -1 : out.position() - offset;
        }
    }
View Full Code Here

                decoder.reset();
            }
            if (result.isMalformed()) {
                throw new MalformedInputException(result.length());
            } else if (result.isUnmappable()) {
                throw new UnmappableCharacterException(result.length());
            }

            return out.position() - offset == 0 ? -1 : out.position() - offset;
        }
    }
View Full Code Here

                decoder.reset();
            }
            if (result.isMalformed()) {
                throw new MalformedInputException(result.length());
            } else if (result.isUnmappable()) {
                throw new UnmappableCharacterException(result.length());
            }

            return out.position() - offset == 0 ? -1 : out.position() - offset;
        }
    }
View Full Code Here

* Test class UnmappableCharacterException.
*/
public class UnmappableCharacterExceptionTest extends TestCase {

  public void testConstructor() {
    UnmappableCharacterException ex = new UnmappableCharacterException(3);
    assertTrue(ex instanceof CharacterCodingException);
    assertNull(ex.getCause());
    assertEquals(ex.getInputLength(), 3);
    assertTrue(ex.getMessage().indexOf("3") != -1);

    ex = new UnmappableCharacterException(-3);
    assertNull(ex.getCause());
    assertEquals(ex.getInputLength(), -3);
    assertTrue(ex.getMessage().indexOf("-3") != -1);

    ex = new UnmappableCharacterException(0);
    assertNull(ex.getCause());
    assertEquals(ex.getInputLength(), 0);
    assertTrue(ex.getMessage().indexOf("0") != -1);

  }
View Full Code Here

    /**
     * @tests serialization/deserialization compatibility.
     */
    public void testSerializationSelf() throws Exception {

        SerializationTest.verifySelf(new UnmappableCharacterException(11),
                COMPARATOR);
    }
View Full Code Here

    /**
     * @tests serialization/deserialization compatibility with RI.
     */
    public void testSerializationCompatibility() throws Exception {

        SerializationTest.verifyGolden(this, new UnmappableCharacterException(
                11), COMPARATOR);
    }
View Full Code Here

                decoder.reset();
            }
            if (result.isMalformed()) {
                throw new MalformedInputException(result.length());
            } else if (result.isUnmappable()) {
                throw new UnmappableCharacterException(result.length());
            }

            return out.position() - offset == 0 ? -1 : out.position() - offset;
        }
    }
View Full Code Here

TOP

Related Classes of java.nio.charset.UnmappableCharacterException

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.