Examples of asFloatBuffer()


Examples of java.nio.ByteBuffer.asFloatBuffer()

          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.getHeap().heap[i]);
          }
          floatbuf.put(floatArray);
View Full Code Here

Examples of java.nio.ByteBuffer.asFloatBuffer()

      IntBuffer ib = bb.asIntBuffer();
      ib.get(_indices);
      bb=ByteBuffer.allocate(bbLen);
    }
    in.readFully(bb.array());
    FloatBuffer fb = bb.asFloatBuffer();
    _data = new float[bbLen/4];
    fb.get(_data);
  }

  public void write(DataOutput out) throws IOException {
View Full Code Here

Examples of java.nio.ByteBuffer.asFloatBuffer()

        IntBuffer ib = bb.asIntBuffer();
        ib.put(_indices);
        out.write(bb.array());
        bb=ByteBuffer.allocate(bbLen);
      }
      FloatBuffer fb = bb.asFloatBuffer();
      fb.put(_data);
      out.write(bb.array());
    }
  }
 
View Full Code Here

Examples of java.nio.ByteBuffer.asFloatBuffer()

    data = new float[in.readInt()][];
    for (int i = 0; i < data.length; ++i) {
      int bbLen = in.readInt();
      ByteBuffer bb=ByteBuffer.allocate(bbLen);
      in.readFully(bb.array());
      FloatBuffer fb = bb.asFloatBuffer();
      data[i] = new float[bbLen/4];
      fb.get(data[i]);
    }
    _nullTrans = in.readFloat();
  }
View Full Code Here

Examples of java.nio.ByteBuffer.asFloatBuffer()

    out.writeInt(data.length);
    for (int i = 0; i < data.length; ++i) {
      int bbLen = data[i].length * 4;
      out.writeInt(bbLen);
      ByteBuffer bb=ByteBuffer.allocate(bbLen);
      FloatBuffer fb = bb.asFloatBuffer();
      fb.put(data[i], 0, data[i].length);
      out.write(bb.array());
    }
    out.writeFloat(_nullTrans);
  }
View Full Code Here

Examples of java.nio.ByteBuffer.asFloatBuffer()

    _ef = new int[bbLen/4];
    ib.get(_ef);
   
    bb=ByteBuffer.allocate(bbLen);
    in.readFully(bb.array());
    FloatBuffer fb = bb.asFloatBuffer();
    _values = new float[bbLen/4];
    fb.get(_values);
    indexLen = _values.length;
  }
View Full Code Here

Examples of java.nio.ByteBuffer.asFloatBuffer()

    ib=bb.asIntBuffer();
    ib.put(_ef, 0, indexLen);
    out.write(bb.array());
   
    bb=ByteBuffer.allocate(bbLen);
    FloatBuffer fb=bb.asFloatBuffer();
    fb.put(_values, 0, indexLen);
    out.write(bb.array());
  }
 
  public String toString() {
View Full Code Here

Examples of java.nio.ByteBuffer.asFloatBuffer()

  private TTable ttable;

  public static void main(String[] args) {
    try { PServer v = null; //new PServer(4444);
    ByteBuffer b = ByteBuffer.allocate(20);
    FloatBuffer fb = b.asFloatBuffer();
    fb.put(0.1f); fb.flip();
    System.out.println(fb.position() + "=fpos   bpos=" + b.position());
    Thread t = new Thread(v);
    t.start();
    try {Thread.sleep(100); } catch (Exception e ) {}
View Full Code Here

Examples of java.nio.ByteBuffer.asFloatBuffer()

            MyJapi.f322bb(MyJapi.f222bb());
            assert (nf222bb + 1 == f222bb.asLongBuffer().get());

            out.println("\ncalling f323bb(f223bb())");
            final ByteBuffer f223bb = MyJapi.f223bb().order(ByteOrder.nativeOrder());
            final float nf223bb = f223bb.asFloatBuffer().get();
            MyJapi.f323bb(f223bb);
            assert (nf223bb == f223bb.asFloatBuffer().get());
            MyJapi.f323bb(MyJapi.f223bb());
            assert (nf223bb + 1 == f223bb.asFloatBuffer().get());
View Full Code Here

Examples of java.nio.ByteBuffer.asFloatBuffer()

            out.println("\ncalling f323bb(f223bb())");
            final ByteBuffer f223bb = MyJapi.f223bb().order(ByteOrder.nativeOrder());
            final float nf223bb = f223bb.asFloatBuffer().get();
            MyJapi.f323bb(f223bb);
            assert (nf223bb == f223bb.asFloatBuffer().get());
            MyJapi.f323bb(MyJapi.f223bb());
            assert (nf223bb + 1 == f223bb.asFloatBuffer().get());

            out.println("\ncalling f324bb(f224bb())");
            final ByteBuffer f224bb = MyJapi.f224bb().order(ByteOrder.nativeOrder());
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.