📄 tunnelserver.java
字号:
/*
* @(#)TunnelServer
*
* Copyright (c) 1998 Karl Moss. All Rights Reserved.
*
* You may study, use, modify, and distribute this software for any
* purpose provided that this copyright notice appears in all copies.
*
* This software is provided WITHOUT WARRANTY either expressed or
* implied.
*
* @author Karl Moss
* @version 1.0
* @date 17Apr98
*
*/
package javaservlets.tunnel.server;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
/**
* <p>This is the base object to be extended by server objects
* that are using HTTP tunneling.
*/
public abstract class TunnelServer extends BaseTunnelServlet
{
/**
* <p>Creates an input stream to be used to read data
* sent from the client.
*
* @param servletInput Servlet input stream from the servlet
* request header
* @return Input stream to read data from the client
*/
public DataInput _getInputStream(ServletInputStream servletInput)
throws IOException
{
// Create a new DataInputStream for reading data from
// the client.
return new ObjectInputStream(servletInput);
}
/**
* <p>Closes the input stream
*
* @param in Input stream to close
*/
public void _close(DataInput in) throws IOException
{
((ObjectInputStream) in).close();
}
/**
* <p>Gets an output stream to be used for writing data to
* an internal buffer. The buffer will be written to the
* client
*
* @param buffer Buffer to hold the output data
* @return Output stream to write data to the buffer
*/
public DataOutput _getOutputStream(ByteArrayOutputStream buffer)
throws IOException
{
// Create a new DataOutputStream for writing data to
// the buffer.
return new ObjectOutputStream(buffer);
}
/**
* <p>Flushes the any buffered data to the output stream
*
* @param out Output stream to flush
*/
public void _flush(DataOutput out) throws IOException
{
// Flush the data to the buffer
((ObjectOutputStream) out).flush();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -