Package java.nio

Examples of java.nio.ByteBuffer.asFloatBuffer()


            final ByteBuffer f463bb = MyJapi.f463bb1().order(ByteOrder.nativeOrder());
            final float nf463bb = f463bb.asFloatBuffer().get();
            MyJapi.f563bb1(f463bb);
            assert (nf463bb == f463bb.asFloatBuffer().get());
            MyJapi.f563bb1(MyJapi.f463bb1());
            assert (nf463bb + 1 == f463bb.asFloatBuffer().get());

            out.println("\ncalling f564bb1(f464bb1())");
            final ByteBuffer f464bb = MyJapi.f464bb1().order(ByteOrder.nativeOrder());
            final double nf464bb = f464bb.asDoubleBuffer().get();
            MyJapi.f564bb1(f464bb);
View Full Code Here


            MyJapi.f582bb1(f482bb);
            assert (nf482bb + 1 == f482bb.asLongBuffer().get());

            out.println("\ncalling f583bb1(f483bb1())");
            final ByteBuffer f483bb = MyJapi.f483bb1().order(ByteOrder.nativeOrder());
            final float nf483bb = f483bb.asFloatBuffer().get();
            MyJapi.f583bb1(f483bb);
            assert (nf483bb + 1 == f483bb.asFloatBuffer().get());

            out.println("\ncalling f584bb1(f484bb1())");
            final ByteBuffer f484bb = MyJapi.f484bb1().order(ByteOrder.nativeOrder());
View Full Code Here

            out.println("\ncalling f583bb1(f483bb1())");
            final ByteBuffer f483bb = MyJapi.f483bb1().order(ByteOrder.nativeOrder());
            final float nf483bb = f483bb.asFloatBuffer().get();
            MyJapi.f583bb1(f483bb);
            assert (nf483bb + 1 == f483bb.asFloatBuffer().get());

            out.println("\ncalling f584bb1(f484bb1())");
            final ByteBuffer f484bb = MyJapi.f484bb1().order(ByteOrder.nativeOrder());
            final double nf484bb = f484bb.asDoubleBuffer().get();
            MyJapi.f584bb1(f484bb);
View Full Code Here

                result = array;
                break;
            }
            case VariableInfo.FLOAT: {
                final float[] array = new float[length];
                buffer.asFloatBuffer().get(array);
                result = array;
                break;
            }
            case VariableInfo.DOUBLE: {
                final double[] array = new double[length];
View Full Code Here

          ByteArrayInputStream bis = new ByteArrayInputStream(buf.array());
          return bis;
        } else if (type.getName().equals(CAS.TYPE_NAME_FLOAT_ARRAY)) {
          arrayStart = getArrayStartAddress(fs.getAddress());
          buf = ByteBuffer.allocate(arraySize * 4);
          FloatBuffer floatbuf = buf.asFloatBuffer();
          float[] floatArray = new float[arraySize];
          for (int i = arrayStart; i < arrayStart + arraySize; i++) {
            floatArray[i - arrayStart] = Float.intBitsToFloat(this.heap.heap[i]);
          }
          floatbuf.put(floatArray);
View Full Code Here

              case FLOAT:
                {
                  FloatBuffer chBuf = (FloatBuffer) getChannelBuffer(name);
                  chBuf.position(((y - ymin) / sy) * numElem);
                  chBuf.put((FloatBuffer) inBuf.asFloatBuffer().limit(numElem));
                  break;
                }

              } // switch (channel.getPixelType())

View Full Code Here

              bytes.asShortBuffer().put((ShortBuffer)
                  ((ShortBuffer) chBuf).duplicate().position(offset).limit(offset + nx));
              break;

            case FLOAT:
              bytes.asFloatBuffer().put((FloatBuffer)
                  ((FloatBuffer) chBuf).duplicate().position(offset).limit(offset + nx));
              break;

            default:
              throw new UnexpectedException("Invalid pixel type");
View Full Code Here

     * @return a new native order, direct ByteBuffer
     */
    public FloatBuffer toByteBuffer() {
        ByteBuffer bbuf = ByteBuffer.allocateDirect(16 * 4);
        bbuf.order(ByteOrder.nativeOrder());
        FloatBuffer fbuf = bbuf.asFloatBuffer();
        fbuf.put(m_data);
        fbuf.flip();

        return fbuf;
    }
View Full Code Here

        driver = gdal.GetDriverByName("GTiff");
           
        ByteBuffer byteBuffer = ByteBuffer.allocateDirect(4 * xsize);
        byteBuffer.order(ByteOrder.nativeOrder());
        FloatBuffer floatBuffer = byteBuffer.asFloatBuffer();
        int[] intArray = new int[xsize];
        float[] floatArray = new float[xsize];
       
        dataset = driver.Create(filename, xsize, ysize, 1, gdalconst.GDT_Float32);
        band = dataset.GetRasterBand(1);
View Full Code Here

   
    IntBuffer iBuffer = buffer.asIntBuffer();
    iBuffer.position(1);
    System.out.println(Memory.getPosition(iBuffer));
   
    FloatBuffer fBuffer = buffer.asFloatBuffer();
    fBuffer.position(1);
    System.out.println(Memory.getPosition(fBuffer));
   
    LongBuffer lBuffer = buffer.asLongBuffer();
    lBuffer.position(1);
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.