Permalink
Browse files

start of a command-line filter program

  • Loading branch information...
1 parent 65b06e3 commit bfea68ba7f061c2cbcfded2c8e9c3a3f91436b91 @league committed Nov 2, 2009
Showing with 25 additions and 0 deletions.
  1. +25 −0 net/contrapunctus/lzma/Command.java
@@ -0,0 +1,25 @@
+package net.contrapunctus.lzma;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.IOException;
+
+public class Command
+{
+ static void copy(InputStream in, OutputStream out) throws IOException
+ {
+ final int BUFSIZE = 4096;
+ byte[] buf = new byte[BUFSIZE];
+ int n = in.read(buf);
+ while(n != -1) {
+ out.write(buf, 0, n);
+ n = in.read(buf);
+ }
+ out.close();
+ }
+
+ public static void main(String[] args) throws IOException
+ {
+ copy(System.in, new LzmaOutputStream(System.out));
+ }
+}

0 comments on commit bfea68b

Please sign in to comment.