001
014
015 package com.liferay.portal.kernel.io.unsync;
016
017 import java.io.IOException;
018 import java.io.Writer;
019
020
023 public class UnsyncTeeWriter extends Writer {
024
025 public UnsyncTeeWriter(Writer writer1, Writer writer2) {
026 _writer1 = writer1;
027 _writer2 = writer2;
028 }
029
030 @Override
031 public Writer append(char c) throws IOException {
032 _writer1.append(c);
033 _writer2.append(c);
034
035 return this;
036 }
037
038 @Override
039 public Writer append(CharSequence charSequence) throws IOException {
040 _writer1.append(charSequence);
041 _writer2.append(charSequence);
042
043 return this;
044 }
045
046 @Override
047 public Writer append(CharSequence charSequence, int start, int end)
048 throws IOException {
049
050 _writer1.append(charSequence, start, end);
051 _writer2.append(charSequence, start, end);
052
053 return this;
054 }
055
056 @Override
057 public void close() throws IOException {
058 _writer1.close();
059 _writer2.close();
060 }
061
062 @Override
063 public void flush() throws IOException {
064 _writer1.flush();
065 _writer2.flush();
066 }
067
068 @Override
069 public void write(char[] chars) throws IOException {
070 _writer1.write(chars);
071 _writer2.write(chars);
072 }
073
074 @Override
075 public void write(char[] chars, int offset, int length) throws IOException {
076 _writer1.write(chars, offset, length);
077 _writer2.write(chars, offset, length);
078 }
079
080 @Override
081 public void write(int c) throws IOException {
082 _writer1.write(c);
083 _writer2.write(c);
084 }
085
086 @Override
087 public void write(String string) throws IOException {
088 _writer1.write(string);
089 _writer2.write(string);
090 }
091
092 @Override
093 public void write(String string, int offset, int length)
094 throws IOException {
095
096 _writer1.write(string, offset, length);
097 _writer2.write(string, offset, length);
098 }
099
100 private Writer _writer1;
101 private Writer _writer2;
102
103 }