[...] while (pointerInBytesArray < listOfDataChatsRecords.size()) { eightBytesForTimeStamp = ByteBuffer.wrap(getByteBufor(8)).order(ByteOrder.LITTLE_ENDIAN).getDouble(); time = new Date(TimeUnit.MILLISECONDS.convert(getUnixTimeStamp(eightBytesForTimeStamp), TimeUnit.SECONDS)); flags = ByteBuffer.wrap(getByteBufor(4)).order(ByteOrder.LITTLE_ENDIAN).getInt(); size = ByteBuffer.wrap(getByteBufor(4)).order(ByteOrder.LITTLE_ENDIAN).getInt(); id = ByteBuffer.wrap(getByteBufor(4)).order(ByteOrder.LITTLE_ENDIAN).getInt(); unknown = ByteBuffer.wrap(getByteBufor(4)).order(ByteOrder.LITTLE_ENDIAN).getInt(); int sizeOfMsg = 0; if (pointerInBytesArray + size > listOfDataChatsRecords.size()) { sizeOfMsg = listOfDataChatsRecords.size() - pointerInBytesArray; } else { sizeOfMsg = size; } try { msg = new String(getByteBufor(sizeOfMsg), "Cp1250"); } catch (UnsupportedEncodingException e) { System.out.println("Problem z kodowaniem"); e.printStackTrace(); } listOfDataObjects.add(new DatChat(time, flags, size, id, unknown, msg)); [...]