Package java.nio

Examples of java.nio.CharBuffer.rewind()


    // Normal case: just after encode with that endOfInput is true
    assertSame(encoder, encoder.reset());
    encoder.encode(CharBuffer.wrap("testCanEncodeIllegalState2"),
        ByteBuffer.allocate(30), true);
    encoder.encode(in, out, true);
    in.rewind();
    out.rewind();

    // Normal case:just after encode with that endOfInput is false
    assertSame(encoder, encoder.reset());
    encoder.encode(CharBuffer.wrap("testCanEncodeIllegalState3"),
View Full Code Here


    // Normal case:just after encode with that endOfInput is false
    assertSame(encoder, encoder.reset());
    encoder.encode(CharBuffer.wrap("testCanEncodeIllegalState3"),
        ByteBuffer.allocate(30), false);
    encoder.encode(in, out, true);
    in.rewind();
    out.rewind();

    // Illegal state: just after flush
    assertSame(encoder, encoder.reset());
    encoder.encode(CharBuffer.wrap("testCanEncodeIllegalState4"),
View Full Code Here

    // Normal case: after canEncode
    assertSame(encoder, encoder.reset());
    encoder.canEncode("\ud906\udc00");
    encoder.encode(in, out, true);
    in.rewind();
    out.rewind();
    assertSame(encoder, encoder.reset());
    encoder.canEncode('\ud905');
    encoder.encode(in, out, true);
  }
View Full Code Here

  public void testEncodeFalseIllegalState() throws CharacterCodingException {
    CharBuffer in = CharBuffer.wrap("aaa");
    ByteBuffer out = ByteBuffer.allocate(5);
    // Normal case: just created
    encoder.encode(in, out, false);
    in.rewind();
    out.rewind();

    // Illegal state: just after encode facade
    assertSame(encoder, encoder.reset());
    encoder.encode(CharBuffer.wrap("testCanEncodeIllegalState1"));
View Full Code Here

    // Normal case:just after encode with that endOfInput is false
    assertSame(encoder, encoder.reset());
    encoder.encode(CharBuffer.wrap("testCanEncodeIllegalState3"),
        ByteBuffer.allocate(30), false);
    encoder.encode(in, out, false);
    in.rewind();
    out.rewind();

    // Illegal state: just after flush
    assertSame(encoder, encoder.reset());
    encoder.encode(CharBuffer.wrap("testCanEncodeIllegalState4"),
View Full Code Here

    // Normal case: after canEncode
    assertSame(encoder, encoder.reset());
    encoder.canEncode("\ud906\udc00");
    encoder.encode(in, out, false);
    in.rewind();
    out.rewind();
    assertSame(encoder, encoder.reset());
    encoder.canEncode('\ud905');
    encoder.encode(in, out, false);
  }
View Full Code Here

        fail("should throw MalformedInputException");
      } catch (MalformedInputException e) {
      }

      encoder.reset();
      in.rewind();
      encoder.onMalformedInput(CodingErrorAction.IGNORE);
      out = encoder.encode(in);
      assertByteArray(out, addSurrogate(unibytes));

      encoder.reset();
View Full Code Here

      encoder.onMalformedInput(CodingErrorAction.IGNORE);
      out = encoder.encode(in);
      assertByteArray(out, addSurrogate(unibytes));

      encoder.reset();
      in.rewind();
      encoder.onMalformedInput(CodingErrorAction.REPLACE);
      out = encoder.encode(in);
      assertByteArray(out, addSurrogate(unibytesWithRep));
    }
View Full Code Here

        fail("should throw UnmappableCharacterException");
      } catch (UnmappableCharacterException e) {
      }

      encoder.reset();
      in.rewind();
      encoder.onUnmappableCharacter(CodingErrorAction.IGNORE);
      out = encoder.encode(in);
      assertByteArray(out, unibytes);

      encoder.reset();
View Full Code Here

      encoder.onUnmappableCharacter(CodingErrorAction.IGNORE);
      out = encoder.encode(in);
      assertByteArray(out, unibytes);

      encoder.reset();
      in.rewind();
      encoder.onUnmappableCharacter(CodingErrorAction.REPLACE);
      out = encoder.encode(in);
      assertByteArray(out, unibytesWithRep);
    }
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.