Examples of asShortBuffer()


Examples of java.nio.ByteBuffer.asShortBuffer()

            }   
            //this.ClassPruner.ensureCapacity(NumClassPruners);
            bb = ByteBuffer.allocate(nShortByteSize * unicharset_size);
            bb.order(bo);
            fis.read(bb.array());
            ShortBuffer sb = bb.asShortBuffer();
            for (int i=0; i<unicharset_size; i++) {
                this.IndexFor[i] = sb.get(i);
            }
            bb = ByteBuffer.allocate(nIntByteSize * NumClasses);
            bb.order(bo);
View Full Code Here

Examples of java.nio.ByteBuffer.asShortBuffer()

        fis.read(bb.array());
      }
      bb = ByteBuffer.allocate(MAX_NUM_CONFIGS * nShortByteSize);
      bb.order(bo);
      fis.read(bb.array());
      ShortBuffer sb = bb.asShortBuffer();
      for (int i = 0; i < this.ConfigLengths.length; i++) {
        this.ConfigLengths[i] = sb.get(i);
      }
      this.ProtoLengths = new short[NumProtoSets
          * Prototype.PROTOS_PER_PROTO_SET];
 
View Full Code Here

Examples of java.nio.ByteBuffer.asShortBuffer()

    dest.order(ByteOrder.nativeOrder());
    ByteBuffer src = ByteBuffer.wrap(audio_bytes);
    src.order(ByteOrder.LITTLE_ENDIAN);
    if (two_bytes_data) {
      ShortBuffer dest_short = dest.asShortBuffer();
      ShortBuffer src_short = src.asShortBuffer();
      while (src_short.hasRemaining())
        dest_short.put(src_short.get());
    } else {
      while (src.hasRemaining())
        dest.put(src.get());
View Full Code Here

Examples of java.nio.ByteBuffer.asShortBuffer()

      ja[i] = iter.getShortNext();
  }

  public ByteBuffer getDataAsByteBuffer() {
    ByteBuffer bb = ByteBuffer.allocate((int) (2 * getSize()));
    ShortBuffer ib = bb.asShortBuffer();
    ib.put((short[]) get1DJavaArray(short.class)); // make sure its in canonical order
    return bb;
  }

  /**
 
View Full Code Here

Examples of java.nio.ByteBuffer.asShortBuffer()

      case NCLibrary.NC_UBYTE:
        return Array.factory( DataType.BYTE.getPrimitiveClassType(), shape, bb.array());

      case NCLibrary.NC_SHORT:
      case NCLibrary.NC_USHORT:
        ShortBuffer sb = bb.asShortBuffer();
        return Array.factory( DataType.BYTE.getPrimitiveClassType(), shape, sb.array());

      case NCLibrary.NC_INT:
      case NCLibrary.NC_UINT:
        IntBuffer ib = bb.asIntBuffer();
View Full Code Here

Examples of java.nio.ByteBuffer.asShortBuffer()

                    in = in.order(ByteOrder.LITTLE_ENDIAN);
                }
                flipCopyWithGamma(in.asIntBuffer(), widthStep()/4, IntBuffer.wrap(a, start, a.length - start), step, gamma, flip);
            } else if (out instanceof DataBufferShort) {
                short[] a = ((DataBufferShort)out).getData();
                flipCopyWithGamma(in.asShortBuffer(), widthStep()/2, ShortBuffer.wrap(a, start, a.length - start), step, true, gamma, flip);
            } else if (out instanceof DataBufferUShort) {
                short[] a = ((DataBufferUShort)out).getData();
                flipCopyWithGamma(in.asShortBuffer(), widthStep()/2, ShortBuffer.wrap(a, start, a.length - start), step, false, gamma, flip);
            } else {
                assert(false);
View Full Code Here

Examples of java.nio.ByteBuffer.asShortBuffer()

            } else if (out instanceof DataBufferShort) {
                short[] a = ((DataBufferShort)out).getData();
                flipCopyWithGamma(in.asShortBuffer(), widthStep()/2, ShortBuffer.wrap(a, start, a.length - start), step, true, gamma, flip);
            } else if (out instanceof DataBufferUShort) {
                short[] a = ((DataBufferUShort)out).getData();
                flipCopyWithGamma(in.asShortBuffer(), widthStep()/2, ShortBuffer.wrap(a, start, a.length - start), step, false, gamma, flip);
            } else {
                assert(false);
            }
        }
View Full Code Here

Examples of java.nio.ByteBuffer.asShortBuffer()

                    out = out.order(ByteOrder.LITTLE_ENDIAN);
                }
                flipCopyWithGamma(IntBuffer.wrap(a, start, a.length - start), step, out.asIntBuffer(), widthStep()/4, gamma, false);
            } else if (in instanceof DataBufferShort) {
                short[] a = ((DataBufferShort)in).getData();
                flipCopyWithGamma(ShortBuffer.wrap(a, start, a.length - start), step, out.asShortBuffer(), widthStep()/2, true, gamma, false);
            } else if (in instanceof DataBufferUShort) {
                short[] a = ((DataBufferUShort)in).getData();
                flipCopyWithGamma(ShortBuffer.wrap(a, start, a.length - start), step, out.asShortBuffer(), widthStep()/2, false, gamma, false);
            } else {
                assert(false);
View Full Code Here

Examples of java.nio.ByteBuffer.asShortBuffer()

            } else if (in instanceof DataBufferShort) {
                short[] a = ((DataBufferShort)in).getData();
                flipCopyWithGamma(ShortBuffer.wrap(a, start, a.length - start), step, out.asShortBuffer(), widthStep()/2, true, gamma, false);
            } else if (in instanceof DataBufferUShort) {
                short[] a = ((DataBufferUShort)in).getData();
                flipCopyWithGamma(ShortBuffer.wrap(a, start, a.length - start), step, out.asShortBuffer(), widthStep()/2, false, gamma, false);
            } else {
                assert(false);
            }
            if (bufferedImage == null && roi == null &&
                    image.getWidth() == width() && image.getHeight() == height()) {
View Full Code Here

Examples of java.nio.ByteBuffer.asShortBuffer()

          ByteArrayInputStream bis = new ByteArrayInputStream(buf.array());
          return bis;
        } else if (type.getName().equals(CAS.TYPE_NAME_SHORT_ARRAY)) {
          arrayStart = this.getHeap().heap[getArrayStartAddress(fs.getAddress())];
          buf = ByteBuffer.allocate(arraySize * 2);
          ShortBuffer shortbuf = buf.asShortBuffer();
          shortbuf.put(this.getShortHeap().heap, arrayStart, arraySize);

          ByteArrayInputStream bis = new ByteArrayInputStream(buf.array());
          return bis;
        } else if (type.getName().equals(CAS.TYPE_NAME_LONG_ARRAY)) {
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.