All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cat.inspiracio.servlet.jsp.PrintJspWriter Maven / Gradle / Ivy

Go to download

Dummy Servlet provides some implementations for the interfaces and classes of the Java Servlet spec that are useful for testing and simulation. Version 5.0.0 is for Servlet 5.0.0.

The newest version!
/*
Copyright 2015 Alexander Bunkenburg 

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cat.inspiracio.servlet.jsp;

import java.io.IOException;
import java.io.PrintWriter;

import jakarta.servlet.jsp.JspWriter;

/** Wraps request.getWriter() : PrintWriter into JspWriter.
 * 
 * No buffering. */
class PrintJspWriter extends JspWriter {

	private static final int BUFFER_SIZE=0;
	private static final boolean AUTO_FLUSH=true;

	private final PrintWriter writer;
	
	protected PrintJspWriter(PrintWriter w){
		super(BUFFER_SIZE, AUTO_FLUSH);
		this.writer=w;
	}

	/** Does nothing. */
	@Override public void clear()throws IOException{}
	
	/** Does nothing. */
	@Override public void clearBuffer()throws IOException{}

	/** @return 0 */
	@Override public int getRemaining(){return 0;}
	
	@Override public void close()throws IOException{writer.close();}
	@Override public void flush()throws IOException{writer.flush();}
	@Override public void newLine()throws IOException{writer.println();}
	@Override public void print(boolean b)throws IOException{writer.print(b);}
	@Override public void print(char c)throws IOException{writer.print(c);}
	@Override public void print(int i)throws IOException{writer.print(i);}
	@Override public void print(long l)throws IOException{writer.print(l);}
	@Override public void print(float f)throws IOException{writer.print(f);}
	@Override public void print(double d)throws IOException{writer.print(d);}
	@Override public void print(char[] cs)throws IOException{writer.print(cs);}	
	@Override public void print(String s)throws IOException{writer.print(s);}
	@Override public void print(Object o)throws IOException{writer.print(o);}
	@Override public void println()throws IOException{writer.println();}
	@Override public void println(boolean b)throws IOException{writer.println(b);}
	@Override public void println(char c)throws IOException{writer.println(c);}
	@Override public void println(int i)throws IOException{writer.println(i);}
	@Override public void println(long l)throws IOException{writer.println(l);}
	@Override public void println(float f)throws IOException{writer.println(f);}
	@Override public void println(double d)throws IOException{writer.println(d);}
	@Override public void println(char[] cs)throws IOException{writer.println(cs);}
	@Override public void println(String s)throws IOException{writer.println(s);}
	@Override public void println(Object o)throws IOException{writer.println(o);}

	@Override public PrintJspWriter append(char c){writer.append(c);return this;}
	@Override public PrintJspWriter append(CharSequence c){writer.append(c);return this;}
	@Override public PrintJspWriter append(CharSequence c, int start, int end){writer.append(c, start, end);return this;}
	
	@Override public void write(char[] characters)throws IOException{writer.write(characters);}
	@Override public void write(int c)throws IOException{writer.write(c);}
	@Override public void write(String s)throws IOException{writer.write(s);}
	@Override public void write(char[] buf, int off, int len)throws IOException{writer.write(buf, off, len);}
	@Override public void write(String s, int off, int len)throws IOException{writer.write(s, off, len);}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy