mirror of
https://github.com/google/brotli.git
synced 2024-11-09 13:40:06 +00:00
add "repeat" to Java toy decoder
PiperOrigin-RevId: 551770992
This commit is contained in:
parent
4fc753e707
commit
0300be36ba
@ -24,21 +24,15 @@ public class Decoder {
|
||||
return totalOut;
|
||||
}
|
||||
|
||||
public static void main(String... args) throws IOException {
|
||||
if (args.length != 2) {
|
||||
System.out.println("Usage: decoder <compressed_in> <decompressed_out>");
|
||||
return;
|
||||
}
|
||||
|
||||
byte[] buffer = new byte[1024 * 1024];
|
||||
private static void decompress(String fromPath, String toPath, byte[] buffer) throws IOException {
|
||||
long start;
|
||||
long bytesDecoded;
|
||||
long end;
|
||||
InputStream in = null;
|
||||
OutputStream out = null;
|
||||
try {
|
||||
in = new FileInputStream(args[0]);
|
||||
out = new FileOutputStream(args[1]);
|
||||
in = new FileInputStream(fromPath);
|
||||
out = new FileOutputStream(toPath);
|
||||
start = System.nanoTime();
|
||||
bytesDecoded = decodeBytes(in, out, buffer);
|
||||
end = System.nanoTime();
|
||||
@ -58,4 +52,21 @@ public class Decoder {
|
||||
double mbDecoded = bytesDecoded / (1024.0 * 1024.0);
|
||||
System.out.println(mbDecoded / timeDelta + " MiB/s");
|
||||
}
|
||||
|
||||
public static void main(String... args) throws IOException {
|
||||
if (args.length != 2 && args.length != 3) {
|
||||
System.out.println("Usage: decoder <compressed_in> <decompressed_out> [repeat]");
|
||||
return;
|
||||
}
|
||||
|
||||
int repeat = 1;
|
||||
if (args.length == 3) {
|
||||
repeat = Integer.parseInt(args[2]);
|
||||
}
|
||||
|
||||
byte[] buffer = new byte[1024 * 1024];
|
||||
for (int i = 0; i < repeat; ++i) {
|
||||
decompress(args[0], args[1], buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user