Package java.nio

Examples of java.nio.ByteBuffer.rewind()


                        }
                        catch(Throwable t) {
                        }
                        body=tmp;
                    }
                    buf.rewind();
                }

                if(terminate)
                    break;
View Full Code Here


                LOG.error(e);
                throw e;
            }
            tmpBuf.flip();
            final int length = tmpBuf.getInt();
            tmpBuf.rewind();
            IoBuffer ioBuf = IoBuffer.wrap(tmpBuf);
            out.write(ioBuf);
            // attempt zero-copy sendfile
            long position = offset + 4;
            long count = length;
View Full Code Here

      for (int i=0;i<payload.length;i++){
     
        temp.put( payload[i].getBuffer( DirectByteBuffer.SS_MSG ));
      }
     
      temp.rewind();
     
      initial_data = temp;
    }
           
    connection.connect(
View Full Code Here

            } else {
              buffer = ByteBuffer.allocate(baos.size());
            }
            buffer.order(ByteOrder.nativeOrder());
            buffer.put(baos.toByteArray());
            buffer.rewind();
        } catch (Exception ioe) {
            ioe.printStackTrace();
        }
        return buffer;
    }   
View Full Code Here

       
        // if ogg vorbis data, we need to pass it unmodified to alBufferData
        buffer = ByteBuffer.allocateDirect(baos.size());
        buffer.order(ByteOrder.nativeOrder());
        buffer.put(baos.toByteArray());
        buffer.rewind();
      } catch (Exception ioe) {
        ioe.printStackTrace();
      }
      return buffer;
    }   
View Full Code Here

             
                di.put(hashset);
               
            }
           
            di.rewind();
           
            hashset.rewind();
           
            //hashes
            byte[][] hashes = new byte[(c!=1)?(c + 1):1][16];
View Full Code Here

        int peerPort;
        ByteBuffer data = Misc.getByteBuffer(4);
        for (int i = 0; i < source_count; i++) {
          for (int j = 0; j < 4; j++) {
            data.clear();
            data.rewind();
            byte b = packet_data.get();
            data.put(b);
            peerID[j] = Convert.intToByte(data.getInt(0));
          }
View Full Code Here

     
      ByteBuffer num = Misc.getByteBuffer(4);
     
      for(FileChunkRequest request : partsData) {
        num.clear();
        num.rewind();
        num.putInt(Convert.longToInt(request.getChunkBegin()));
        packet.insertData(num.array());
      }
     
      for(FileChunkRequest request : partsData) {
View Full Code Here

        packet.insertData(num.array());
      }
     
      for(FileChunkRequest request : partsData) {
        num.clear();
        num.rewind();
        num.putInt(Convert.longToInt(request.getChunkEnd()));
        packet.insertData(num.array());
      }
     
      return packet;
View Full Code Here

                msgDigest.finalDigest(di);
            } else {
                di.put(hashset);
            }
           
            di.rewind();
            hashset.rewind();
            //hashes
            byte[][] hashes = new byte[(c!=1)?(c + 1):1][16];
            di.get(hashes[0]);
            for (int j = 1; j < hashes.length; j++) {
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.