source: josm/trunk/src/org/tukaani/xz/FinishableWrapperOutputStream.java@ 13350

Last change on this file since 13350 was 13350, checked in by stoecker, 6 years ago

see #15816 - add XZ support

File size: 1.8 KB
Line 
1/*
2 * FinishableWrapperOutputStream
3 *
4 * Author: Lasse Collin <lasse.collin@tukaani.org>
5 *
6 * This file has been put into the public domain.
7 * You can do whatever you want with this file.
8 */
9
10package org.tukaani.xz;
11
12import java.io.OutputStream;
13import java.io.IOException;
14
15/**
16 * Wraps an output stream to a finishable output stream for use with
17 * raw encoders. This is not needed for XZ compression and thus most
18 * people will never need this.
19 */
20public class FinishableWrapperOutputStream extends FinishableOutputStream {
21 /**
22 * The {@link java.io.OutputStream OutputStream} that has been
23 * wrapped into a FinishableWrapperOutputStream.
24 */
25 protected OutputStream out;
26
27 /**
28 * Creates a new output stream which support finishing.
29 * The <code>finish()</code> method will do nothing.
30 */
31 public FinishableWrapperOutputStream(OutputStream out) {
32 this.out = out;
33 }
34
35 /**
36 * Calls {@link java.io.OutputStream#write(int) out.write(b)}.
37 */
38 public void write(int b) throws IOException {
39 out.write(b);
40 }
41
42 /**
43 * Calls {@link java.io.OutputStream#write(byte[]) out.write(buf)}.
44 */
45 public void write(byte[] buf) throws IOException {
46 out.write(buf);
47 }
48
49 /**
50 * Calls {@link java.io.OutputStream#write(byte[],int,int)
51 out.write(buf, off, len)}.
52 */
53 public void write(byte[] buf, int off, int len) throws IOException {
54 out.write(buf, off, len);
55 }
56
57 /**
58 * Calls {@link java.io.OutputStream#flush() out.flush()}.
59 */
60 public void flush() throws IOException {
61 out.flush();
62 }
63
64 /**
65 * Calls {@link java.io.OutputStream#close() out.close()}.
66 */
67 public void close() throws IOException {
68 out.close();
69 }
70}
Note: See TracBrowser for help on using the repository browser.