當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。