Package java.nio

Examples of java.nio.CharBuffer.clear()


    // normal case, one complete operation, but call twice, first time set
    // endOfInput to false
    decoder.reset();
    in.rewind();
    out.clear();
    assertSame(CoderResult.UNDERFLOW, decoder.decode(in, out, false));
    assertEquals(out.limit(), 100);
    assertEquals(out.position(), unistr.length());
    assertEquals(out.remaining(), 100 - unistr.length());
    assertEquals(out.capacity(), 100);
View Full Code Here


    assertEquals(out.capacity(), 100);
    assertCharBufferValue(out, unistr);

    decoder.reset();
    in.rewind();
    out.clear();
    assertSame(CoderResult.UNDERFLOW, decoder.decode(in, out, false));
    in = ByteBuffer.wrap(unibytes);
    assertSame(CoderResult.UNDERFLOW, decoder.decode(in, out, false));
    in.rewind();
    assertSame(CoderResult.UNDERFLOW, decoder.decode(in, out, true));
View Full Code Here

      decoder.onUnmappableCharacter(CodingErrorAction.REPORT);
      CoderResult result = decoder.decode(in, out, endOfInput);
      assertTrue(result.isUnmappable());

      decoder.reset();
      out.clear();
      in.rewind();
      decoder.onUnmappableCharacter(CodingErrorAction.IGNORE);
      assertSame(CoderResult.UNDERFLOW, decoder.decode(in, out,
          endOfInput));
      assertCharBufferValue(out, " buffer");
View Full Code Here

      assertSame(CoderResult.UNDERFLOW, decoder.decode(in, out,
          endOfInput));
      assertCharBufferValue(out, " buffer");

      decoder.reset();
      out.clear();
      in.rewind();
      decoder.onUnmappableCharacter(CodingErrorAction.REPLACE);
      assertSame(CoderResult.UNDERFLOW, decoder.decode(in, out,
          endOfInput));
      assertCharBufferValue(out, decoder.replacement() + " buffer");
View Full Code Here

      decoder.onMalformedInput(CodingErrorAction.REPORT);
      CoderResult result = decoder.decode(in, out, endOfInput);
      assertTrue(result.isMalformed());

      decoder.reset();
      out.clear();
      in.rewind();
      decoder.onMalformedInput(CodingErrorAction.IGNORE);
      assertSame(CoderResult.UNDERFLOW, decoder.decode(in, out,
          endOfInput));
      assertCharBufferValue(out, " buffer");
View Full Code Here

      assertSame(CoderResult.UNDERFLOW, decoder.decode(in, out,
          endOfInput));
      assertCharBufferValue(out, " buffer");

      decoder.reset();
      out.clear();
      in.rewind();
      decoder.onMalformedInput(CodingErrorAction.REPLACE);
      assertSame(CoderResult.UNDERFLOW, decoder.decode(in, out,
          endOfInput));
      assertCharBufferValue(out, decoder.replacement() + " buffer");
View Full Code Here

    long total = 0;
    while (from.read(buf) != -1) {
      buf.flip();
      to.append(buf);
      total += buf.remaining();
      buf.clear();
    }
    return total;
  }

  /**
 
View Full Code Here

            errln("Overflow exception while decoding UTF32BE (1) should have been thrown.");
        } catch (Exception ex) {
        }
       
        bs.clear();
        us.clear();
        //test malform buffer
        bs.put((byte)0x00); bs.put((byte)0x00); bs.put((byte)0xD9); bs.put((byte)0x02);
        us.put((char)0x0000);
       
        us.limit(us.position());
View Full Code Here

            errln("Malform exception while decoding UTF32BE (2) should have been thrown.");
        } catch (Exception ex) {
        }
       
        bs.clear();
        us.clear();
        //test malform buffer
        bs.put((byte)0x00); bs.put((byte)0x00); bs.put((byte)0xFE); bs.put((byte)0xFF);
        bs.put((byte)0x10); bs.put((byte)0xFF); bs.put((byte)0xDF);
        us.put((char)0x0000);
       
View Full Code Here

            errln("Malform exception while decoding UTF32BE (3) should have been thrown.");
        } catch (Exception ex) {
        }
       
        bs.clear();
        us.clear();
        //test overflow buffer
        bs.put((byte)0x00); bs.put((byte)0x00); bs.put((byte)0xFE); bs.put((byte)0xFF);
        bs.put((byte)0x00); bs.put((byte)0x10); bs.put((byte)0xFF); bs.put((byte)0xDD);
        us.put((char)0x0000);
       
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.