fork download
  1. import java.io.*;
  2. import java.util.zip.GZIPOutputStream;
  3.  
  4. public class Main {
  5. public static void main(String[] args) {
  6. String inFile = args[0];
  7. String outFile = args[1];
  8. FileInputStream fis = null;
  9. GZIPOutputStream gzos = null;
  10. try {
  11. fis = new FileInputStream(inFile);
  12. FileOutputStream fos = new FileOutputStream(outFile);
  13. gzos = new GZIPOutputStream(bos);
  14. int i = fis.read();
  15. while(i != -1) {
  16. gzos.write(i);
  17. i = fis.read();
  18. }
  19. gzos.flush();
  20. gzos.close();
  21. fis.close();
  22. } catch(IOException e) {
  23. System.err.println("エラーです。");
  24. try {
  25. if(fis != null) {
  26. fis.close();
  27. }
  28. if(gzos != null) {
  29. gzos.close();
  30. }
  31. } catch(IOException e2) {
  32. }
  33. }
  34. }
  35. }
Runtime error #stdin #stdout #stderr 0.07s 2841600KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
	at Main.main(Main.java:6)