Package java.nio

Examples of java.nio.CharBuffer.clear()


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

  /**
 
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

        decoder.onMalformedInput(CodingErrorAction.REPLACE);
        decoder.onUnmappableCharacter(CodingErrorAction.REPLACE);

        // Add each byte one at a time.
        bb.clear();
        cb.clear();
        for (int i = 0; i < len; i++) {
            bb.put((byte) testCase.input[i]);
            bb.flip();
            CoderResult cr = decoder.decode(bb, cb, false);
            if (cr.isError()) {
View Full Code Here

                                      ? ByteBuffer.allocate(charsRead
                                          * m_maxCharWidth)
                                      : m_byteBuffer;

                //
                cb.clear();
                bb.clear();
                cb.put(cbuf, off, charsRead);
                cb.flip();
                m_encoder.encode(cb, bb, /*endOfinput*/ true);
                bb.flip();
View Full Code Here

                cb.flip();

                final char[] chars = new char[cb.length()];

                cb.get(chars);
                cb.clear();

                try {
                    clob.setChars(session, m_position, chars, 0, chars.length);
                } catch (Exception e) {
                    throw new IOException(e.toString());
View Full Code Here

                //
                int charsRead;
                int bytesRead;

                if (cb.remaining() == 0) {
                    cb.clear();

                    charsRead = m_reader.read(cb);

                    cb.flip();
View Full Code Here

          ByteBuffer.wrap(new byte[] { -1, -2, 32, 0, 98 }), out,
          true).isMalformed());

      decoder.flush(out);
      decoder.reset();
      out.clear();
      assertSame(CoderResult.UNDERFLOW, decoder.decode(ByteBuffer
          .wrap(new byte[] { -1, -2, 32, 0 }), out, false));
      assertTrue(decoder.decode(ByteBuffer.wrap(new byte[] { 98 }), out,
          true).isMalformed());
View Full Code Here

      assertTrue(decoder.decode(ByteBuffer.wrap(new byte[] { 98 }), out,
          true).isMalformed());

      decoder.flush(out);
      decoder.reset();
      out.clear();
      assertSame(CoderResult.UNDERFLOW, decoder.decode(ByteBuffer
          .wrap(new byte[] { -1, -2, 32, 0, 98 }), out, false));
      assertFalse(decoder
          .decode(ByteBuffer.wrap(new byte[] {}), out, true)
          .isMalformed());
View Full Code Here

          .decode(ByteBuffer.wrap(new byte[] {}), out, true)
          .isMalformed());

      decoder.flush(out);
      decoder.reset();
      out.clear();
      assertFalse(decoder.decode(
          ByteBuffer.wrap(new byte[] { -1, -2, 32, 0, 98, 0 }), out,
          true).isError());

      decoder.flush(out);
View Full Code Here

          ByteBuffer.wrap(new byte[] { -1, -2, 32, 0, 98, 0 }), out,
          true).isError());

      decoder.flush(out);
      decoder.reset();
      out.clear();
      assertSame(CoderResult.UNDERFLOW, decoder.decode(ByteBuffer
          .wrap(new byte[] { -1, -2, 32, 0, 98 }), out, false));
      assertTrue(decoder.decode(ByteBuffer.wrap(new byte[] { 0 }), out,
          true).isMalformed());
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.