コード例 #1
0
  public byte[] convertEventToRawString(CriticalSectionEvent event) {
    try (ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        DataOutputStream output = new DataOutputStream(byteArrayOutputStream)) {
      output.writeLong(event.getTime().getMillis());
      output.writeLong(event.getTime().getNanos());
      output.writeChar(event.discriminator());

      return byteArrayOutputStream.toByteArray();
    } catch (IOException e) {
      e
          .printStackTrace(); // To change body of catch statement use File | Settings | File
                              // Templates.
      return new byte[0];
    }
  }
コード例 #2
0
 private int compareTime(CriticalSectionEvent a, CriticalSectionEvent b) {
   return a.getTime().compareTo(b.getTime());
 }