Package java.nio

Examples of java.nio.ByteBuffer.asShortBuffer()


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

              case FLOAT:
                {
View Full Code Here


              bytes.asIntBuffer().put((IntBuffer)
                  ((IntBuffer) chBuf).duplicate().position(offset).limit(offset + nx));
              break;

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

            case FLOAT:
              bytes.asFloatBuffer().put((FloatBuffer)
View Full Code Here

  public static void main(String[] args) {
    byte[] x = new byte[2];
    ByteBuffer buf = ByteBuffer.wrap(x);
    buf.order(ByteOrder.LITTLE_ENDIAN);
    buf.asShortBuffer().put(Half.valueOf(3.283691e-2f).toShortBits());
    System.out.printf("%02x %02x", x[0], x[1]);
    System.out.println();


    System.out.println(Half.valueOf(3.283691e-2f).floatValue());
View Full Code Here

    int frames = PdBase.blockSize() * ticks;
    short[] dummy = new short[0];
    short[] samples = new short[frames * outChans];
    byte[] rawSamples = new byte[samples.length * sampleSize];
    ByteBuffer buf = ByteBuffer.wrap(rawSamples);
    ShortBuffer shortBuf = buf.asShortBuffer();

    while (!terminated) {  // Note: sourceDataLine.write seems to clear the interrupted flag, and so Thread.interrupted() doesn't work here.
      PdBase.process(ticks, dummy, samples);
      shortBuf.rewind();
      shortBuf.put(samples);
View Full Code Here

        channel.read(tmpBuffer);
        dais.close();

        tmpBuffer.rewind();
        instance.costs = tmpBuffer.asShortBuffer();

        return instance;
    }
}
View Full Code Here

        setCJKSupport(os2_Table);

        ByteBuffer head_Table = getTableBuffer(headTag);
        int upem = -1;
        if (head_Table != null && head_Table.capacity() >= 18) {
            ShortBuffer sb = head_Table.asShortBuffer();
            upem = sb.get(9) & 0xffff;
        }
        setStrikethroughMetrics(os2_Table, upem);

        ByteBuffer post_Table = getTableBuffer(postTag);
View Full Code Here

        byte[] name = new byte[256];
        ByteBuffer buffer = getTableBuffer(nameTag);

        if (buffer != null) {
            ShortBuffer sbuffer = buffer.asShortBuffer();
            sbuffer.get(); // format - not needed.
            short numRecords = sbuffer.get();
            /* The name table uses unsigned shorts. Many of these
             * are known small values that fit in a short.
             * The values that are sizes or offsets into the table could be
View Full Code Here

        String foundName = null;
        byte[] name = new byte[1024];

        ByteBuffer buffer = getTableBuffer(nameTag);
        if (buffer != null) {
            ShortBuffer sbuffer = buffer.asShortBuffer();
            sbuffer.get(); // format - not needed.
            short numRecords = sbuffer.get();

            /* The name table uses unsigned shorts. Many of these
             * are known small values that fit in a short.
View Full Code Here

        byte[] name = new byte[256];
        ByteBuffer buffer = getTableBuffer(nameTag);

        if (buffer != null) {
            ShortBuffer sbuffer = buffer.asShortBuffer();
            sbuffer.get(); // format - not needed.
            short numRecords = sbuffer.get();

            /* The name table uses unsigned shorts. Many of these
             * are known small values that fit in a short.
View Full Code Here

          if (audioFormat.isBigEndian()) {
            bob.order(ByteOrder.BIG_ENDIAN);
          } else {
            bob.order(ByteOrder.LITTLE_ENDIAN);
          }
          ShortBuffer sb = bob.asShortBuffer();
          sbAsArrays = new short[sb.capacity()];
          sb.get(sbAsArrays);
          executeJS(sbAsArrays);
          repaint();
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.