Package java.nio

Examples of java.nio.ByteBuffer.asIntBuffer()


 
  public void renderIntArray(Token token){
       int[] data = (int[]) token.getObject();

          ByteBuffer byteBuffer = ByteBuffer.allocate(data.length * 4);       
          IntBuffer intBuffer = byteBuffer.asIntBuffer();
          intBuffer.put(data);

          byte[] array = byteBuffer.array();
      String str = Base64.encodeBytes(array);
      props.put(token.getId()+".base64", str);
View Full Code Here


    */
   public int readInt() throws IOException
   {
      ByteBuffer dst = ByteBuffer.allocate(4);
      readFully(dst);
      return dst.asIntBuffer().get();
   }

   /**
    * {@inheritDoc}
    */
 
View Full Code Here

                    }
                    while (input.read(buffer) > 0) {
                        ;
                    }
                    buffer.flip();
                    IntBuffer ibuffer = buffer.asIntBuffer();
                    int ibuffRemain = Math.min(ibuffer.remaining(), countIDs);
                    ibuffer.get(streams, 0, ibuffRemain);
                    for (int i = 0; i < ibuffRemain; i++) {
                        if (streams[i] == meta.streamID) {
                            offsetFound = offset + i + 1;
View Full Code Here

    byte[] bytes = e.get(attr);
    if (bytes == null)
      return null;

    ByteBuffer buf = ByteBuffer.wrap(bytes);
    return buf.asIntBuffer().get();
  }

  public static Long readLong(Event e, String attr) {
    Type t = map.get(attr);
    Preconditions.checkArgument(t == Type.LONG || t == null);
View Full Code Here

          ByteArrayInputStream bis = new ByteArrayInputStream( sb.toString().getBytes("UTF-8") );
          return bis;
        } else if (type.getName().equals(CAS.TYPE_NAME_INTEGER_ARRAY)) {
          arrayStart = getArrayStartAddress(fs.getAddress());
          buf = ByteBuffer.allocate(arraySize * 4);
          IntBuffer intbuf = buf.asIntBuffer();
          intbuf.put(this.getHeap().heap, arrayStart, arraySize);
          ByteArrayInputStream bis = new ByteArrayInputStream(buf.array());
          return bis;
        } else if (type.getName().equals(CAS.TYPE_NAME_FLOAT_ARRAY)) {
          arrayStart = getArrayStartAddress(fs.getAddress());
View Full Code Here

    private static void writeFromArrayRegion(WritableByteChannel ch, int[] array, int off, int len) throws IOException {

        ByteBuffer buf = getCachedBufferForChannel(ch);
        buf.limit(ExtraMath.multiplyExact(len, SizeOf.INT));

        buf.asIntBuffer().put(array, off, len); // the position of the byte buffer is not changed

        ExtraChannels.writeBytes(ch, buf);
    }

    /*
 
View Full Code Here

        ByteBuffer buf = getCachedBufferForChannel(ch);
        buf.limit(ExtraMath.multiplyExact(len, SizeOf.INT));

        ExtraChannels.readBytes(ch, buf, BufferOperation.RESTORE_POSITION);

        buf.asIntBuffer().get(array, off, len);
    }

    private static ByteBuffer getCachedBufferForChannel(WritableByteChannel ch) {

        final ByteBuffer buf;
View Full Code Here

            add(new CustomAnimation(srcName, dstName, mipmapLevel, tileCount, x, y, w, h, imageData, height / h, properties));
            if (((x | y | w | h) & 0x1) != 0 || w <= 0 || h <= 0) {
                break;
            }
            ByteBuffer newImage = ByteBuffer.allocateDirect(width * height);
            MipmapHelper.scaleHalf(imageData.asIntBuffer(), width, height, newImage.asIntBuffer());
            imageData = newImage;
            width >>= 1;
            height >>= 1;
            x >>= 1;
            y >>= 1;
View Full Code Here

    private static void update(String texture, int x, int y, int w, int h, ByteBuffer imageData) {
        int mipmaps = getMipmapLevels();
        for (int i = 1; i <= mipmaps && ((x | y | w | h) & mipmapAlignment) == 0; i++) {
            ByteBuffer newImage = ByteBuffer.allocateDirect(w * h);
            scaleHalf(imageData.asIntBuffer(), w, h, newImage.asIntBuffer());
            x >>= 1;
            y >>= 1;
            w >>= 1;
            h >>= 1;
            int width = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, i, GL11.GL_TEXTURE_WIDTH);
View Full Code Here

  public final static class Monkey{
    final IntBuffer buf;

    public Monkey(){
      ByteBuffer bb = ByteBuffer.allocateDirect(Integer.MAX_VALUE);
      buf = bb.asIntBuffer();
    }

    public final void set(int index, int value){
      buf.put(index, value);
    }
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.