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


Java IApimanBuffer.getNativeBuffer方法代码示例

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


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

示例1: write

import io.apiman.gateway.engine.io.IApimanBuffer; //导入方法依赖的package包/类
/**
 * @see io.apiman.gateway.engine.io.IWriteStream#write(io.apiman.gateway.engine.io.IApimanBuffer)
 */
@Override
public void write(IApimanBuffer chunk) {
    try {
        if (!connected) {
            throw new IOException("Not connected."); //$NON-NLS-1$
        }
        if (outputStream == null) {
            outputStream = connection.getOutputStream();
        }
        if (chunk instanceof ByteBuffer) {
            byte[] buffer = (byte[]) chunk.getNativeBuffer();
            outputStream.write(buffer, 0, chunk.length());
        } else {
            outputStream.write(chunk.getBytes());
        }
    } catch (IOException e) {
        handleConnectionError(e);
    }
}
 
开发者ID:apiman,项目名称:apiman,代码行数:23,代码来源:HttpApiConnection.java

示例2: write

import io.apiman.gateway.engine.io.IApimanBuffer; //导入方法依赖的package包/类
@Override
public void write(IApimanBuffer chunk) {
    if (inboundFinished) {
        throw new IllegalStateException(Messages.getString("HttpConnector.0"));
    }

    if (chunk.getNativeBuffer() instanceof Buffer) {
        clientRequest.write((Buffer) chunk.getNativeBuffer());
        // When write queue has diminished sufficiently, drain handler will be invoked.
        if (clientRequest.writeQueueFull() && drainHandler != null) {
            clientRequest.drainHandler(drainHandler::handle);
        }
    } else {
        throw new IllegalArgumentException(Messages.getString("HttpConnector.1"));
    }
}
 
开发者ID:apiman,项目名称:apiman,代码行数:17,代码来源:HttpConnector.java

示例3: getNativeBuffer

import io.apiman.gateway.engine.io.IApimanBuffer; //导入方法依赖的package包/类
private Buffer getNativeBuffer(IApimanBuffer buffer) {
	if (buffer.getNativeBuffer() instanceof Buffer) {
		return (Buffer) buffer.getNativeBuffer();
	} else {
		logger.debug("Received an IApimanBuffer with a non-Vert.x implementation. " //$NON-NLS-1$
				+ "This will function but may require copying and be less efficient."); //$NON-NLS-1$
		return Buffer.buffer(buffer.getBytes());
	}
}
 
开发者ID:apiman,项目名称:apiman,代码行数:10,代码来源:HttpClientComponentImpl.java


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