1 package org.codehaus.plexus.components.io.resources;
2
3 import java.io.IOException;
4 import java.io.InputStream;
5
6
7
8
9 public class ClosingInputStream extends InputStream {
10 private final InputStream target;
11
12 private final InputStream other;
13
14 public ClosingInputStream(InputStream target, InputStream other) {
15 this.target = target;
16 this.other = other;
17 }
18
19 @Override
20 public int read() throws IOException {
21 return target.read();
22 }
23
24 @Override
25 public int read(byte[] b) throws IOException {
26 return target.read(b);
27 }
28
29 @Override
30 public int read(byte[] b, int off, int len) throws IOException {
31 return target.read(b, off, len);
32 }
33
34 @Override
35 public long skip(long n) throws IOException {
36 return target.skip(n);
37 }
38
39 @Override
40 public int available() throws IOException {
41 return target.available();
42 }
43
44 @Override
45 public void close() throws IOException {
46 other.close();
47 target.close();
48 }
49
50 @Override
51 public void mark(int readlimit) {
52 target.mark(readlimit);
53 }
54
55 @Override
56 public void reset() throws IOException {
57 target.reset();
58 }
59
60 @Override
61 public boolean markSupported() {
62 return target.markSupported();
63 }
64 }