Package java.nio

Examples of java.nio.CharBuffer.position()


        if (!cr.isUnderflow())
            throw new IllegalArgumentException(cr.toString());
        cr = cd.flush(cb);
        if (!cr.isUnderflow())
            throw new IllegalArgumentException(cr.toString());
        return new String(ca, 0, cb.position());
    }

    String toString(byte[] ba) {
        return toString(ba, ba.length);
    }
View Full Code Here


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

    return n - c;
  }
View Full Code Here

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

    return n - c;
  }
View Full Code Here

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

    return n - c;
  }
View Full Code Here

            cbuf.clear();
            int size = reader.read(cbuf);
            if (size <= 0) {
                break;
            }
            cbuf.limit(cbuf.position());
            cbuf.rewind();
            boolean eof = false;
            while (!eof) {
                CoderResult cr = encoder.encode(cbuf, bbuf, eof);
                if (cr.isError()) {
View Full Code Here

              // escape characters interpreted as backslash by mysql
              if(charsetEncoder != null) {
                CharBuffer cbuf = CharBuffer.allocate(1);
                ByteBuffer bbuf = ByteBuffer.allocate(1);
                cbuf.put(c);
                cbuf.position(0);
                charsetEncoder.encode(cbuf, bbuf, true);
                if(bbuf.get(0) == '\\') {
                  buf.append('\\');
                }
              }
View Full Code Here

      CharsetEncoder enc = Charset.forName(getEncoding()).newEncoder();
      CharBuffer cbuf = CharBuffer.allocate(1);
      ByteBuffer bbuf = ByteBuffer.allocate(1);

      cbuf.put("\u00a5");
      cbuf.position(0);
      enc.encode(cbuf, bbuf, true);
      if(bbuf.get(0) == '\\') {
        requiresEscapingEncoder = true;
      } else {
        cbuf.clear();
View Full Code Here

      } else {
        cbuf.clear();
        bbuf.clear();
       
        cbuf.put("\u20a9");
        cbuf.position(0);
        enc.encode(cbuf, bbuf, true);
        if(bbuf.get(0) == '\\') {
          requiresEscapingEncoder = true;
        }
      }
View Full Code Here

      cr = cd.flush(cb);
      if (!cr.isUnderflow()) cr.throwException();
    } catch (CharacterCodingException x) {      
      throw new Error(x);
    }
    return trim(ca, cb.position());
  }
 
 
}
View Full Code Here

            } catch (CharacterCodingException x) {
                // Substitution is always enabled,
                // so this shouldn't happen
                throw new Error(x);
            }
            return safeTrim(ca, cb.position(), cs, isTrusted);
        }
    }

    static char[] decode(byte[] ba, int off, int len) {
        String csn = Charset.defaultCharset().name();
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.