1 7 8 package java.io; 9 10 27 public 28 class FilterOutputStream extends OutputStream { 29 32 protected OutputStream out; 33 34 43 public FilterOutputStream(OutputStream out) { 44 this.out = out; 45 } 46 47 59 public void write(int b) throws IOException { 60 out.write(b); 61 } 62 63 79 public void write(byte b[]) throws IOException { 80 write(b, 0, b.length); 81 } 82 83 103 public void write(byte b[], int off, int len) throws IOException { 104 if ((off | len | (b.length - (len + off)) | (off + len)) < 0) 105 throw new IndexOutOfBoundsException (); 106 107 for (int i = 0 ; i < len ; i++) { 108 write(b[off + i]); 109 } 110 } 111 112 122 public void flush() throws IOException { 123 out.flush(); 124 } 125 126 138 public void close() throws IOException { 139 try { 140 flush(); 141 } catch (IOException ignored) { 142 } 143 out.close(); 144 } 145 } 146 | Popular Tags |