7677787980818283848586
final int micros = fraction * 1000; SnoopPacketRecordImpl.initBuffer(data, included, original, record, drops, seconds, micros); data.clear(); return data; } public static void initBuffer(final ByteBuffer b, final int included,
225226227228229230231232233234235
public static ByteOrder checkFormat(ReadableByteChannel in) throws IOException { ByteBuffer b = ByteBuffer.allocate(8); in.read(b); b.clear(); if (SnoopFile.headerReader.readType(b) != RecordType.BlockRecord) { return null; }
126127128129130131132133134135136
r.put(b); /* * Now reset the buffer */ r.clear(); return r; } private ByteBuffer[] convertToBufferArray(final SnoopRecord[] elements)
120121122123124125126127128129130
} else{ bin.put(in,0,in.length-(i%3)); bin.flip(); System.out.println("write buffer"+m.write(bin)); bin.clear(); } for(int j=0;j<in.length;j++){ in[j]++; } }
251252253254255256257258259260261
byte[] peerID = new byte[4]; 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)); }
10651066106710681069107010711072107310741075
packet.insertData(fileHash.getHash()); ByteBuffer num = Misc.getByteBuffer(4); for(FileChunkRequest request : partsData) { num.clear(); num.rewind(); num.putInt(Convert.longToInt(request.getChunkBegin())); packet.insertData(num.array()); }
582583584585586587588589590591592
.getShort()); ByteBuffer message_bytes = Misc .getByteBuffer(message_length); packet_data.get(message_bytes.array()); String message = new String(message_bytes.array()); message_bytes.clear(); message_bytes = null; _peer_manager.receivedMessage(peerIP, peerPort, message); break; }
10721073107410751076107710781079108010811082
num.putInt(Convert.longToInt(request.getChunkBegin())); packet.insertData(num.array()); } for(FileChunkRequest request : partsData) { num.clear(); num.rewind(); num.putInt(Convert.longToInt(request.getChunkEnd())); packet.insertData(num.array()); }
344345346347348349350351352353354
block.position(0); writeChannel.write(block); } block.clear(); System.gc(); if ((bytes - byteCount)==0) return ; ByteBuffer block2 = Misc.getByteBuffer(bytes - byteCount);
353354355356357358359360361362363
ByteBuffer block2 = Misc.getByteBuffer(bytes - byteCount); block2.position(0); writeChannel.write(block2); block2.clear(); } catch (IOException e) { e.printStackTrace(); }