4 * License : The MIT License
5 * Copyright(c) 2016 olyutorskii
8 package jp.sourceforge.jindolf.archiver;
10 import java.io.IOException;
11 import java.io.PipedReader;
12 import java.io.PipedWriter;
13 import java.io.Reader;
14 import java.io.Writer;
19 public class SnifWriter extends Writer{
21 private final Writer fout;
23 private final Writer pout;
24 private final Reader reader;
29 * @param writer 移譲先Writer
31 public SnifWriter(Writer writer){
34 if(writer == null) throw new NullPointerException();
37 PipedWriter pipeOut = new PipedWriter();
38 PipedReader pipeIn = new PipedReader();
41 pipeOut.connect(pipeIn);
42 }catch(IOException e){
58 public Reader getSnifReader(){
64 * @throws IOException {@inheritDoc}
67 public void close() throws IOException{
75 * @throws IOException {@inheritDoc}
78 public void flush() throws IOException{
86 * @param cbuf {@inheritDoc}
87 * @param off {@inheritDoc}
88 * @param len {@inheritDoc}
89 * @throws IOException {@inheritDoc}
92 public void write(char[] cbuf, int off, int len) throws IOException{
93 this.fout.write(cbuf, off, len);
94 this.pout.write(cbuf, off, len);
100 * @param str {@inheritDoc}
101 * @param off {@inheritDoc}
102 * @param len {@inheritDoc}
103 * @throws IOException {@inheritDoc}
106 public void write(String str, int off, int len) throws IOException {
107 this.fout.write(str, off, len);
108 this.pout.write(str, off, len);
114 * @param c {@inheritDoc}
115 * @throws IOException {@inheritDoc}
118 public void write(int c) throws IOException {