aboutsummaryrefslogtreecommitdiff
path: root/usage_examples/CleanupExample_pre.jpage
blob: 9f6391710a7da1a0ee1c5792d19b1971f9fc43af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import lombok.Cleanup;
import java.io.*;

public class CleanupExample {
	public static void main(String[] args) throws IOException {
		@Cleanup InputStream in = new FileInputStream(args[0]);
		@Cleanup OutputStream out = new FileOutputStream(args[1]);
		byte[] b = new byte[10000];
		while (true) {
			int r = in.read(b);
			if (r == -1) break;
			out.write(b, 0, r);
		}
	}
}