1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  package org.abstracthorizon.danube.support.logging;
14  
15  import java.io.IOException;
16  import java.io.OutputStream;
17  
18  
19  
20  
21  
22  
23  
24  public class DirectionalLoggingOutputStream extends LoggingOutputStream {
25  
26      
27      protected boolean flag = true;
28  
29      
30  
31  
32  
33  
34      public DirectionalLoggingOutputStream(OutputStream outputStream, OutputStream logOutputStream) {
35          super(outputStream, logOutputStream);
36      }
37  
38      @Override
39      public void write(byte[] b) throws IOException {
40          write(b, 0, b.length);
41      }
42  
43      @Override
44      public void write(byte[] b, int off, int len) throws IOException {
45          outputStream.write(b, off, len);
46          if (logging) { flag = DirectionalLoggingInputStream.output(flag, logOutputStream, '<', b, off, len); }
47      }
48  
49      @Override
50      public void write(int b) throws IOException {
51          outputStream.write(b);
52          if (logging) { flag = DirectionalLoggingInputStream.output(flag, logOutputStream, '<', b);  }
53      }
54  
55  }