Package java.nio

Examples of java.nio.CharBuffer.flip()


                cr.throwException();
            }
        } catch (CharacterCodingException x) {
            throw new IllegalStateException(x);
        }
        return dst.flip().toString();
    }

    private ChannelBuffers() {
        // Unused
    }
View Full Code Here


      } else {
        break;
      }
    }

    output.flip();
    CharBuffer truncatedBuffer = null;
    // truncate elements after limit in the output.
    // clippedBuffer has the same value of capcity and limit.
    if (output.limit() == output.capacity()) {
      truncatedBuffer = output;
View Full Code Here

    if (output.limit() == output.capacity()) {
      truncatedBuffer = output;
    } else {
      truncatedBuffer = CharBuffer.allocate(output.remaining());
      truncatedBuffer.put(output);
      truncatedBuffer.flip();
    }
    status = FLUSH;
    return truncatedBuffer;
  }
View Full Code Here

      remains = null;
    } else {
      encodingBuffer = CharBuffer.allocate(in.remaining());
    }
    encodingBuffer.put(in);
    encodingBuffer.flip();

    CoderResult result = CoderResult.UNDERFLOW;
    if (encodingBuffer.remaining() > 0) {
      while (true) {
        CodingErrorAction action = null;
View Full Code Here

      {
         char[] chars = s.toCharArray();
      Charset cs = Charset.forName ("UTF-8");
        CharBuffer cb = CharBuffer.allocate (chars.length);
        cb.put (chars);
                 cb.flip ();
        ByteBuffer bb = cs.encode (cb);
       
        return bb.array();
      }
      else
View Full Code Here

            final FileReader reader = new FileReader(config._temp);
            final CharBuffer buffer = CharBuffer.allocate(256 * 1024);
            reader.read(buffer);
            reader.close();
            config._temp.delete();
            buffer.flip();

            final String raw = buffer.toString();
            System.out.print(raw);
            final Stats stats = new Stats(raw);
            System.out.println(stats);
View Full Code Here

   * Creates a string representing the account.
   */
  public String account() {
    final CharBuffer buf = allocate(11);
    appendAccount(buf);
    return buf.flip().toString();
  }

  /**
   * Creates a string representing the entity.
   */
 
View Full Code Here

   * Creates a string representing the entity.
   */
  public String entity() {
    final CharBuffer buf = allocate(3);
    appendEntity(buf);
    return buf.flip().toString();
  }

  /**
   * Creates a string representing the branch.
   */
 
View Full Code Here

   * Creates a string representing the branch.
   */
  public String branch() {
    final CharBuffer buf = allocate(4);
    appendBranch(buf);
    return buf.flip().toString();
  }

  /**
   * Creates a string representing the type.
   */
 
View Full Code Here

   * Creates a string representing the type.
   */
  public String type() {
    final CharBuffer buf = allocate(2);
    appendType(buf);
    return buf.flip().toString();
  }

  @SuppressWarnings("unused")
  private static final int v1Alt(final int[] code, int pos1, int pos2) {
    int sum = 0;
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.