nullbufferpool.java

来自「银行项目为后台socket通信写的程序」· Java 代码 · 共 28 行

JAVA
28
字号
/****************************************************************************
 * Package		: com.ecSolutions.ecAppServer.server.buffer
 * File			: NullBufferPool.java
 * Create Date  : 2007-7-20
 * Author		: Steven Chen
 * 
 * Copyright(C) 2006 ecSolutions(shanghai) Co.,Limited.All Rights Reserved.
 *			
 ***************************************************************************/
package com.ecSolutions.ecAppServer.server.buffer;

import com.ecSolutions.ecAppServer.server.Buffer;

/**
 * Null buffer pool. Always allocate new buffer.
 * 
 * @author Steven Chen
 * @version $Id: NullBufferPool.java,v 1.2 2007/07/26 03:14:22 stevenchen Exp $
 */
public class NullBufferPool implements BufferPool {

    public Buffer allocate(int capacity, boolean direct) {
        return direct ? (Buffer) ByteBufferBuffer.allocate(capacity, true)
                : ByteArrayBuffer.allocate(capacity);
    }

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?