当前位置: 首页>>代码示例>>Java>>正文


Java Socket.getReceiveBufferSize方法代码示例

本文整理汇总了Java中java.net.Socket.getReceiveBufferSize方法的典型用法代码示例。如果您正苦于以下问题:Java Socket.getReceiveBufferSize方法的具体用法?Java Socket.getReceiveBufferSize怎么用?Java Socket.getReceiveBufferSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.net.Socket的用法示例。


在下文中一共展示了Socket.getReceiveBufferSize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: SocketInputBuffer

import java.net.Socket; //导入方法依赖的package包/类
/**
 * Creates an instance of this class.
 *
 * @param socket the socket to read data from.
 * @param buffersize the size of the internal buffer. If this number is less
 *   than <code>0</code> it is set to the value of
 *   {@link Socket#getReceiveBufferSize()}. If resultant number is less
 *   than <code>1024</code> it is set to <code>1024</code>.
 * @param params HTTP parameters.
 */
public SocketInputBuffer(
        final Socket socket,
        int buffersize,
        final HttpParams params) throws IOException {
    super();
    if (socket == null) {
        throw new IllegalArgumentException("Socket may not be null");
    }
    this.socket = socket;
    this.eof = false;
    if (buffersize < 0) {
        buffersize = socket.getReceiveBufferSize();
    }
    if (buffersize < 1024) {
        buffersize = 1024;
    }
    init(socket.getInputStream(), buffersize, params);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:29,代码来源:SocketInputBuffer.java

示例2: SocketInputBuffer

import java.net.Socket; //导入方法依赖的package包/类
/**
 * Creates an instance of this class.
 *
 * @param socket the socket to read data from.
 * @param buffersize the size of the internal buffer. If this number is less
 *   than <code>0</code> it is set to the value of
 *   {@link Socket#getReceiveBufferSize()}. If resultant number is less
 *   than <code>1024</code> it is set to <code>1024</code>.
 * @param params HTTP parameters.
 */
public SocketInputBuffer(
        final Socket socket,
        final int buffersize,
        final HttpParams params) throws IOException {
    super();
    Args.notNull(socket, "Socket");
    this.socket = socket;
    this.eof = false;
    int n = buffersize;
    if (n < 0) {
        n = socket.getReceiveBufferSize();
    }
    if (n < 1024) {
        n = 1024;
    }
    init(socket.getInputStream(), n, params);
}
 
开发者ID:mozilla-mobile,项目名称:FirefoxData-android,代码行数:28,代码来源:SocketInputBuffer.java

示例3: ObjectReader

import java.net.Socket; //导入方法依赖的package包/类
/**
 * Creates an <code>ObjectReader</code> for a TCP socket
 * @param socket Socket
 */
public ObjectReader(Socket socket) {
    try{
        this.buffer = new XByteBuffer(socket.getReceiveBufferSize(), true);
    }catch ( IOException x ) {
        //unable to get buffer size
        log.warn("Unable to retrieve the socket receiver buffer size, setting to default 43800 bytes.");
        this.buffer = new XByteBuffer(43800,true);
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:14,代码来源:ObjectReader.java

示例4: ObjectReader

import java.net.Socket; //导入方法依赖的package包/类
/**
 * Creates an <code>ObjectReader</code> for a TCP socket
 * 
 * @param socket
 *            Socket
 */
public ObjectReader(Socket socket) {
	try {
		this.buffer = new XByteBuffer(socket.getReceiveBufferSize(), true);
	} catch (IOException x) {
		// unable to get buffer size
		log.warn("Unable to retrieve the socket receiver buffer size, setting to default 43800 bytes.");
		this.buffer = new XByteBuffer(43800, true);
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:16,代码来源:ObjectReader.java


注:本文中的java.net.Socket.getReceiveBufferSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。