publicclass FlaterCriticalArray { // If true, print information about performance privatestaticfinalboolean debug = System.getProperty("debug") != null;
privatestaticvoid debug(String s) { if (debug) System.out.println(s);
}
privatestaticvoid debug(String name, String inOut, long time, int length) {
debug(name + ": Duration of " + inOut + "(in ms): " + time);
debug(name + ": " + inOut + "d data length: " + length + " bytes");
}
privatestaticbyte[] grow(byte[] a, int capacity) { while (a.length < capacity) { byte[] a2 = newbyte[a.length * 2];
System.arraycopy(a, 0, a2, 0, a.length);
a = a2;
} return a;
}
privatestaticbyte[] trim(byte[] a, int length) { byte[] res = newbyte[length];
System.arraycopy(a, 0, res, 0, length); return res;
}
/* *Baseclassforindividualtestcases
*/ privateabstractstaticclass TestCase { protected String name; // For information in debug messages protectedbyte data[]; // Data to be deflated and subsequently inflated protectedint level; // Compression level for deflater
if (args.length > 1) {
FileInputStream fis = new FileInputStream(args[1]); int len = fis.available();
data = newbyte[len];
check(fis.read(data, 0, len) == len, "Did not read complete file");
debug("Original data from " + args[1]);
fis.close();
} else {
ByteBuffer bb = ByteBuffer.allocate(8);
ByteArrayOutputStream baos = new ByteArrayOutputStream(); for (int i = 0; i < 1024 * 64; i++) { // data length
bb.putDouble(0, Math.random());
baos.write(bb.array(), 0, 8);
}
data = baos.toByteArray();
debug("Original data from random byte array");
}
debug("Original data length: " + data.length + " bytes");
new StrideTest(data, level).runTest(); new NoStrideTest(data, level).runTest(); new GZIPTest(data).runTest();
}
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.11Bemerkung:
(Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können 2026-06-10)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.