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


Java StreamSourceChannel.resumeReads方法代码示例

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


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

示例1: parse

import org.xnio.channels.StreamSourceChannel; //导入方法依赖的package包/类
@Override
public void parse(HttpHandler handler) throws Exception {
    if (exchange.getAttachment(FORM_DATA) != null) {
        handler.handleRequest(exchange);
        return;
    }
    this.handler = handler;
    StreamSourceChannel channel = exchange.getRequestChannel();
    if (channel == null) {
        throw new IOException(UndertowMessages.MESSAGES.requestChannelAlreadyProvided());
    } else {
        doParse(channel);
        if (state != 4) {
            channel.getReadSetter().set(this);
            channel.resumeReads();
        } else {
            exchange.dispatch(SameThreadExecutor.INSTANCE, handler);
        }
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:21,代码来源:FormEncodedDataDefinition.java

示例2: setup

import org.xnio.channels.StreamSourceChannel; //导入方法依赖的package包/类
public void setup(final StreamSourceChannel channel) {
    Pooled<ByteBuffer> resource = bufferPool.allocate();
    ByteBuffer buffer = resource.getResource();
    try {
        int r = 0;
        do {
            r = channel.read(buffer);
            if (r == 0) {
                channel.getReadSetter().set(this);
                channel.resumeReads();
            } else if (r == -1) {
                stringDone(string.extract());
                IoUtils.safeClose(channel);
            } else {
                buffer.flip();
                string.write(buffer);
            }
        } while (r > 0);
    } catch (IOException e) {
        error(e);
    } finally {
        resource.free();
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:25,代码来源:StringReadChannelListener.java

示例3: handleRequest

import org.xnio.channels.StreamSourceChannel; //导入方法依赖的package包/类
@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
    if (hasBody(exchange)) {    // parse body early, not process until body is read (e.g. for chunked), to save one blocking thread during read
        FormDataParser parser = formParserFactory.createParser(exchange);
        if (parser != null) {
            parser.parse(handler);
            return;
        }

        RequestBodyReader reader = new RequestBodyReader(exchange, handler);
        StreamSourceChannel channel = exchange.getRequestChannel();
        reader.read(channel);  // channel will be null if getRequestChannel() is already called, but here should not be that case
        if (!reader.complete()) {
            channel.getReadSetter().set(reader);
            channel.resumeReads();
            return;
        }
    }

    exchange.dispatch(handler);
}
 
开发者ID:neowu,项目名称:core-ng-project,代码行数:22,代码来源:HTTPServerIOHandler.java

示例4: setup

import org.xnio.channels.StreamSourceChannel; //导入方法依赖的package包/类
public void setup(StreamSourceChannel channel) {
	channel.suspendReads();
	channel.getReadSetter().set(this);
	channel.resumeReads();
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:6,代码来源:UndertowXhrTransport.java


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