001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *     http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017
018package org.apache.logging.log4j.io.internal;
019
020import java.io.PrintWriter;
021import java.io.Writer;
022import java.util.Locale;
023
024import org.apache.logging.log4j.Level;
025import org.apache.logging.log4j.Marker;
026import org.apache.logging.log4j.io.LoggerFilterWriter;
027import org.apache.logging.log4j.io.LoggerWriter;
028import org.apache.logging.log4j.spi.ExtendedLogger;
029
030/**
031 * Internal class that exists primiarly to allow location calculations to work.
032 *
033 * @since 2.12
034 */
035public class InternalPrintWriter extends PrintWriter {
036
037    public InternalPrintWriter(final ExtendedLogger logger, final boolean autoFlush, final String fqcn,
038                                final Level level, final Marker marker) {
039        super(new InternalWriter(logger, fqcn, level, marker), autoFlush);
040    }
041
042    public InternalPrintWriter(final Writer writer, final boolean autoFlush, final ExtendedLogger logger,
043                                final String fqcn, final Level level, final Marker marker) {
044        super(new InternalFilterWriter(writer, logger, fqcn, level, marker), autoFlush);
045    }
046
047    @Override
048    public InternalPrintWriter append(final char c) {
049        super.append(c);
050        return this;
051    }
052
053    @Override
054    public InternalPrintWriter append(final CharSequence csq) {
055        super.append(csq);
056        return this;
057    }
058
059    @Override
060    public InternalPrintWriter append(final CharSequence csq, final int start, final int end) {
061        super.append(csq, start, end);
062        return this;
063    }
064
065    @Override
066    public boolean checkError() {
067        return super.checkError();
068    }
069
070    @Override
071    public void close() {
072        super.close();
073    }
074
075    @Override
076    public void flush() {
077        super.flush();
078    }
079
080    @Override
081    public InternalPrintWriter format(final Locale l, final String format, final Object... args) {
082        super.format(l, format, args);
083        return this;
084    }
085
086    @Override
087    public InternalPrintWriter format(final String format, final Object... args) {
088        super.format(format, args);
089        return this;
090    }
091
092    @Override
093    public void print(final boolean b) {
094        super.print(b);
095    }
096
097    @Override
098    public void print(final char c) {
099        super.print(c);
100    }
101
102    @Override
103    public void print(final char[] s) {
104        super.print(s);
105    }
106
107    @Override
108    public void print(final double d) {
109        super.print(d);
110    }
111
112    @Override
113    public void print(final float f) {
114        super.print(f);
115    }
116
117    @Override
118    public void print(final int i) {
119        super.print(i);
120    }
121
122    @Override
123    public void print(final long l) {
124        super.print(l);
125    }
126
127    @Override
128    public void print(final Object obj) {
129        super.print(obj);
130    }
131
132    @Override
133    public void print(final String s) {
134        super.print(s);
135    }
136
137    @Override
138    public InternalPrintWriter printf(final Locale l, final String format, final Object... args) {
139        super.printf(l, format, args);
140        return this;
141    }
142
143    @Override
144    public InternalPrintWriter printf(final String format, final Object... args) {
145        super.printf(format, args);
146        return this;
147    }
148
149    @Override
150    public void println() {
151        super.println();
152    }
153
154    @Override
155    public void println(final boolean x) {
156        super.println(x);
157    }
158
159    @Override
160    public void println(final char x) {
161        super.println(x);
162    }
163
164    @Override
165    public void println(final char[] x) {
166        super.println(x);
167    }
168
169    @Override
170    public void println(final double x) {
171        super.println(x);
172    }
173
174    @Override
175    public void println(final float x) {
176        super.println(x);
177    }
178
179    @Override
180    public void println(final int x) {
181        super.println(x);
182    }
183
184    @Override
185    public void println(final long x) {
186        super.println(x);
187    }
188
189    @Override
190    public void println(final Object x) {
191        super.println(x);
192    }
193
194    @Override
195    public void println(final String x) {
196        super.println(x);
197    }
198
199    @Override
200    public String toString() {
201        return "{stream=" + this.out + '}';
202    }
203
204    @Override
205    public void write(final char[] buf) {
206        super.write(buf);
207    }
208
209    @Override
210    public void write(final char[] buf, final int off, final int len) {
211        super.write(buf, off, len);
212    }
213
214    @Override
215    public void write(final int c) {
216        super.write(c);
217    }
218
219    @Override
220    public void write(final String s) {
221        super.write(s);
222    }
223
224    @Override
225    public void write(final String s, final int off, final int len) {
226        super.write(s, off, len);
227    }
228}