Package java.nio

Examples of java.nio.CharBuffer.remaining()


          return -1;
        }
        break;
      }

      int remain = char_buf.remaining();
      if (remain > n) {
        remain = n;
      }
      char_buf.get(buf, offset, remain);
      n -= remain;
View Full Code Here


      CharBuffer char_buf = getReadCharBuffer();
      if (char_buf == null) {
        break;
      }

      int remain = char_buf.remaining();
      if (remain > c) {
        remain = (int) c;
      }
      char_buf.position(char_buf.position() + remain);
      c -= remain;
View Full Code Here

    while (count > 0) {
      if (!char_buf.hasRemaining()) {
        char_buf = getWriteCharBuffer();
      }
      int remain = char_buf.remaining();
      if (remain > count) {
        remain = count;
      }
      char_buf.put(buf, offset, remain);
      count -= remain;
View Full Code Here

        flushWriteBuffer();
      } else if (res == CoderResult.UNDERFLOW && char_buf.hasRemaining()) {
        // Create new underflow buf containing the remaining chars and room
        // for one more char. The longest sequence of characters that can
        // represent a single code point is 2 (a pair of surrogate chars).
        underflow_char_buf_ = CharBuffer.allocate(char_buf.remaining() + 1);
        // Copy the characters over to the underflow_char_buf_. Note that
        // calling underflow_char_buf_.append(char_buf) is not correct because
        // it does not properly advance the position of char_buf.
        while (char_buf.hasRemaining()) {
          underflow_char_buf_.put(char_buf.get());
View Full Code Here

          return -1;
        }
        break;
      }

      int remain = char_buf.remaining();
      if (remain > n) {
        remain = n;
      }
      char_buf.get(buf, offset, remain);
      n -= remain;
View Full Code Here

      CharBuffer char_buf = getReadCharBuffer();
      if (char_buf == null) {
        break;
      }

      int remain = char_buf.remaining();
      if (remain > c) {
        remain = (int) c;
      }
      char_buf.position(char_buf.position() + remain);
      c -= remain;
View Full Code Here

    while (count > 0) {
      if (!char_buf.hasRemaining()) {
        char_buf = getWriteCharBuffer();
      }
      int remain = char_buf.remaining();
      if (remain > count) {
        remain = count;
      }
      char_buf.put(buf, offset, remain);
      count -= remain;
View Full Code Here

        flushWriteBuffer();
      } else if (res == CoderResult.UNDERFLOW && char_buf.hasRemaining()) {
        // Create new underflow buf containing the remaining chars and room
        // for one more char. The longest sequence of characters that can
        // represent a single code point is 2 (a pair of surrogate chars).
        underflow_char_buf_ = CharBuffer.allocate(char_buf.remaining() + 1);
        // Copy the characters over to the underflow_char_buf_. Note that
        // calling underflow_char_buf_.append(char_buf) is not correct because
        // it does not properly advance the position of char_buf.
        while (char_buf.hasRemaining()) {
          underflow_char_buf_.put(char_buf.get());
View Full Code Here

        public ByteBuffer putString(
                CharSequence val, CharsetEncoder encoder ) throws CharacterCodingException
        {
            CharBuffer in = CharBuffer.wrap( val );
            int expectedLength = (int) (in.remaining() * encoder.averageBytesPerChar());

            encoder.reset();

            for (;;) {
                CoderResult cr;
View Full Code Here

            }
            if (cr.isOverflow()) {
                if (isAutoExpand()) {
                    switch (expandedState) {
                    case 0:
                        autoExpand((int) Math.ceil(in.remaining()
                                * encoder.averageBytesPerChar()));
                        expandedState++;
                        break;
                    case 1:
                        autoExpand((int) Math.ceil(in.remaining()
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.