From 4f4cb3643b493b77fa24376552fe9e9c2a1d2162 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Mon, 14 Nov 2005 18:31:07 +0000 Subject: [PATCH] change diff format to better suit HQ --- .../java/src/net/hyperic/sigar/FileInfo.java | 237 +++++++++--------- 1 file changed, 123 insertions(+), 114 deletions(-) diff --git a/bindings/java/src/net/hyperic/sigar/FileInfo.java b/bindings/java/src/net/hyperic/sigar/FileInfo.java index 578a97f3..07c86413 100644 --- a/bindings/java/src/net/hyperic/sigar/FileInfo.java +++ b/bindings/java/src/net/hyperic/sigar/FileInfo.java @@ -1,9 +1,14 @@ package net.hyperic.sigar; +import java.text.SimpleDateFormat; +import java.util.ArrayList; import java.util.Date; public class FileInfo extends FileAttrs { + private static final SimpleDateFormat DATE_FORMAT = + new SimpleDateFormat("MMM dd HH:mm"); + String name; private Sigar sigar; private boolean dirStatEnabled = false; @@ -168,6 +173,52 @@ public class FileInfo extends FileAttrs { } } + private class Diff { + private String attr, old, cur; + + Diff(String attr, String old, String cur) { + this.attr = attr; + this.old = old; + this.cur = cur; + } + + Diff(String attr, int old, int cur) { + this(attr, + String.valueOf(old), + String.valueOf(cur)); + } + + Diff(String attr, long old, long cur) { + this(attr, + String.valueOf(old), + String.valueOf(cur)); + } + + public String toString() { + return this.attr + ": " + + this.old + "|" + this.cur; + } + } + + private StringBuffer format(ArrayList changes) { + StringBuffer sb = new StringBuffer(); + + if (changes.size() == 0) { + return sb; + } + + int size = changes.size(); + for (int i=0; i