Package java.nio

Examples of java.nio.ByteBuffer.asIntBuffer()


      uima[1] = 73; // I
      uima[2] = 77; // M
      uima[3] = 65; // A

      ByteBuffer buf = ByteBuffer.wrap(uima);
      int key = buf.asIntBuffer().get();

      int version = 1;
      dos.writeInt(key);
      dos.writeInt(version);
View Full Code Here


      uima[1] = 73; // I
      uima[2] = 77; // M
      uima[3] = 65; // A

      ByteBuffer buf = ByteBuffer.wrap(uima);
      int key = buf.asIntBuffer().get();

      int version = 2;    //1 = current full serialization; 2 = delta format
                          //perhaps this should be split into 2 bytes for version and 2 bytes for format.
      dos.writeInt(key);
      dos.writeInt(version);
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

        ByteBuffer buf = null;
        Type type = fs.getType();
        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

    }
   
    public void esperarEventos(){
        String result;
        ByteBuffer buffer = ByteBuffer.allocate(8);
        IntBuffer intBuffer = buffer.asIntBuffer();
        try {
            while(true){
                buffer.clear();
                int numBytesRead =sc.read(buffer);
                if (numBytesRead == -1) {
View Full Code Here

        }
    }
   
    public void enviar(int cod, int param){
        ByteBuffer buffer = ByteBuffer.allocate(8);
        IntBuffer intBuffer = buffer.asIntBuffer();
       
        intBuffer.put(0, cod);
        intBuffer.put(1, param);
        try {
                if (buffer !=null){
View Full Code Here

      ByteBuffer buff = ByteBuffer.allocate((int)file.length());     
      channel.read(buff);
      buff.rewind();     
     
      int size_ = ((int)file.length())/4;
      IntBuffer intBuffer = buff.asIntBuffer();
      for(int i = 0; i < size_; i++) {
        if(cacher.add(intBuffer.get(i))) size++;
      }
     
      buff.clear();
View Full Code Here

      ByteBuffer buff = ByteBuffer.allocate((int)file.length());     
      channel.read(buff);
      buff.rewind();     
     
      int size_ = ((int)file.length())/4;
      IntBuffer intBuffer = buff.asIntBuffer();
      for(int i = 0; i < size_; i++) {
        if(cacher.add(intBuffer.get(i))) size++;
      }
     
      buff.clear();
View Full Code Here

      uima[1] = 73; // I
      uima[2] = 77; // M
      uima[3] = 65; // A

      ByteBuffer buf = ByteBuffer.wrap(uima);
      int key = buf.asIntBuffer().get();

      int version = 1;
      dos.writeInt(key);
      dos.writeInt(version);
View Full Code Here

        ByteBuffer buf = null;
        Type type = fs.getType();
        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

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.