Facebook
From Robert, 3 Years ago, written in Java.
Embed
Download Paste or View Raw
Hits: 58
  1. [...]
  2. while (pointerInBytesArray < listOfDataChatsRecords.size()) {
  3.  
  4.             eightBytesForTimeStamp = ByteBuffer.wrap(getByteBufor(8)).order(ByteOrder.LITTLE_ENDIAN).getDouble();
  5.             time = new Date(TimeUnit.MILLISECONDS.convert(getUnixTimeStamp(eightBytesForTimeStamp), TimeUnit.SECONDS));
  6.             flags = ByteBuffer.wrap(getByteBufor(4)).order(ByteOrder.LITTLE_ENDIAN).getInt();
  7.             size = ByteBuffer.wrap(getByteBufor(4)).order(ByteOrder.LITTLE_ENDIAN).getInt();
  8.             id = ByteBuffer.wrap(getByteBufor(4)).order(ByteOrder.LITTLE_ENDIAN).getInt();
  9.             unknown = ByteBuffer.wrap(getByteBufor(4)).order(ByteOrder.LITTLE_ENDIAN).getInt();
  10.  
  11.             int sizeOfMsg = 0;
  12.             if (pointerInBytesArray + size > listOfDataChatsRecords.size()) {
  13.                 sizeOfMsg = listOfDataChatsRecords.size() - pointerInBytesArray;
  14.             } else {
  15.                 sizeOfMsg = size;
  16.             }
  17.  
  18.             try {
  19.                 msg = new String(getByteBufor(sizeOfMsg), "Cp1250");
  20.             } catch (UnsupportedEncodingException e) {
  21.                 System.out.println("Problem z kodowaniem");
  22.                 e.printStackTrace();
  23.             }
  24.  
  25.             listOfDataObjects.add(new DatChat(time, flags, size, id, unknown, msg));
  26.  
  27.   [...]