public static synchronized void updateByteCount(long in, long out) { long lastIn = mlastByteCount[0]; long lastOut = mlastByteCount[1]; long diffIn = mlastByteCount[2] = in - lastIn; long diffOut = mlastByteCount[3] = out - lastOut; mlastByteCount = new long[] {in, out, diffIn, diffOut}; for (ByteCountListener bcl : byteCountListener) { bcl.updateByteCount(in, out, diffIn, diffOut); } }
public static synchronized void addByteCountListener(ByteCountListener bcl) { bcl.updateByteCount(mlastByteCount[0], mlastByteCount[1], mlastByteCount[2], mlastByteCount[3]); byteCountListener.add(bcl); }