📄 tunnelclient.java
字号:
/*
* @(#)TunnelClient
*
* 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.client;
import java.io.*;
/**
* <p>This class implements the necessary TunnelClientInterface
* methods for a JDK 1.1 tunneled client. The marshaling of
* data is done with serialization.
*/
public abstract class TunnelClient extends BaseTunnelClient
{
/**
* <p>Gets an input stream to be used for reading data
* from the connection. The lite version uses a standard
* data input stream for reading data.
*
* @param in Input stream from the connection URL
* @return Input stream to read data from the connection
*/
public DataInput _getInputStream(InputStream in)
throws IOException
{
// Create a new DataInputStream for reading data from
// the connection.
return new ObjectInputStream(in);
}
/**
* <p>Gets an output stream to be used for writing data to
* an internal buffer. The buffer will be written to the
* connection. The lite version uses a standard data
* output stream for writing data.
*
* @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();
}
/**
* <p>Closes the input stream
*
* @param in Input stream to close
*/
public void _close(DataInput in) throws IOException
{
((ObjectInputStream) in).close();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -