Package java.nio

Examples of java.nio.ShortBuffer.remaining()


        // Loop until all shorts have been put.
        do {
            // Determine number of shorts to put.
            int numToPut = Math.min(len - numPut,
                                    viewBuffer.remaining());

            // If no shorts to put, the buffer has to be full as len
            // is always greater than numPut so flush it and return
            // to start of loop.
            if(numToPut == 0) {
View Full Code Here


    for (int i = 0; i < histogram.length; ++i) histogram[i] = 0;
    ShortBuffer depth = depthMD.getData().createShortBuffer();
    depth.rewind();

    int points = 0;
    while (depth.remaining() > 0) {
      short depthVal = depth.get();
      if (depthVal != 0) {
        histogram[depthVal]++;
        points++;
      }
View Full Code Here

      context.waitAnyUpdateAll();
      float[] histogram = calcHist();
      ShortBuffer depth = depthMD.getData().createShortBuffer();
      depth.rewind();

      while (depth.remaining() > 0) {
        int pos = depth.position();
        short pixel = depth.get();
        imgbytes[pos] = (byte) histogram[pixel];
      }
    } catch (GeneralException e) {
View Full Code Here

  public void readFully(short[] s, int off, int len) throws IOException
  {
    checkClosed();
   
    ShortBuffer buffer = this.buffer.asShortBuffer();
    if (len > buffer.remaining())
      throw new EOFException();
   
    buffer.get(s, off, len);
  }
 
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.