undertow-core-2.0.13.Final.jar
登录
|
io.undertow:undertow-core:2.0.13.Final
io
undertow
io
UndertowOptions.java
security
protocols
conduits
predicate
connector
util
PathTemplate.java
Headers.java
NewInstanceObjectPool.java
SubstringMap.java
Methods.java
SimpleAttachmentKey.java
HeaderToken.java
NetworkUtils.java
ByteRange.java
StringReadChannelListener.java
CopyOnWriteMap.java
WorkerUtils.java
CanonicalPathUtils.java
ImmediatePooled.java
URLUtils.java
StringWriteChannelListener.java
StatusCodes.java
Attachable.java
LegacyCookieSupport.java
QValueParser.java
ConduitFactory.java
ImmediatePooledByteBuffer.java
ChainedHandlerWrapper.java
RedirectBuilder.java
ImmediateConduitFactory.java
ETag.java
LocaleUtils.java
Cookies.java
MimeMappings.java
Transfer.java
PooledAdaptor.java
HeaderMap.java
FileUtils.java
MalformedMessageException.java
ParameterLimitException.java
ETagUtils.java
ConnectionUtils.java
AttachmentKey.java
Rfc6265CookieSupport.java
Protocols.java
PathTemplateMatch.java
Certificates.java
PathMatcher.java
HeaderValues.java
PooledObject.java
ClosingChannelExceptionHandler.java
AbstractAttachable.java
MultipartParser.java
Sessions.java
FlexBase64.java
BadRequestException.java
HeaderTokenParser.java
PathTemplateMatcher.java
AttachmentList.java
HttpString.java
SimpleObjectPool.java
ImmediateAuthenticationMechanismFactory.java
HexConverter.java
FastConcurrentDirectDeque.java
SameThreadExecutor.java
ConcurrentDirectDeque.java
ObjectPool.java
PipeliningExecutor.java
PortableConcurrentDirectDeque.java
DateUtils.java
ReferenceCountedPooled.java
QueryParameterUtils.java
Version.java
Undertow.java
UndertowLogger.java
version.properties
channels
UndertowLogger_$logger.java
server
attribute
UndertowMessages_$bundle.java
Handlers.java
client
websockets
UndertowMessages.java
META-INF
StringReadChannelListener.java
清空
类结构
/* * JBoss, Home of Professional Open Source. * Copyright 2014 Red Hat, Inc., and individual contributors * as indicated by the @author tags. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.undertow.util; import java.io.
IOException
; import java.nio.
ByteBuffer
; import io.undertow.connector.
PooledByteBuffer
; import io.undertow.server.
XnioByteBufferPool
; import io.undertow.websockets.core.
UTF8Output
; import org.xnio.
ChannelListener
; import org.xnio.
IoUtils
; import io.undertow.connector.
ByteBufferPool
; import org.xnio.
Pool
; import org.xnio.channels.
StreamSourceChannel
; /** * Simple utility class for reading a string * <p> * todo: handle unicode properly * * @author Stuart Douglas */ public abstract class
StringReadChannelListener
implements
ChannelListener
<
StreamSourceChannel
> { private final
UTF8Output
string
= new
UTF8Output
(); private final
ByteBufferPool
bufferPool
; public
StringReadChannelListener
(final
ByteBufferPool
bufferPool
) { this.
bufferPool
=
bufferPool
; } @
Deprecated
public
StringReadChannelListener
(final
Pool
<
ByteBuffer
>
bufferPool
) { this.
bufferPool
= new
XnioByteBufferPool
(
bufferPool
); } public void
setup
(final
StreamSourceChannel
channel
) {
PooledByteBuffer
resource
=
bufferPool
.
allocate
();
ByteBuffer
buffer
=
resource
.
getBuffer
(); 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
.
close
(); } } @
Override
public void
handleEvent
(final
StreamSourceChannel
channel
) {
PooledByteBuffer
resource
=
bufferPool
.
allocate
();
ByteBuffer
buffer
=
resource
.
getBuffer
(); try { int
r
= 0; do {
r
=
channel
.
read
(
buffer
); if (
r
== 0) { return; } 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
.
close
(); } } protected abstract void
stringDone
(
String
string
); protected abstract void
error
(
IOException
e
); }
查找资源
Jre/Lib
输入类名或文件名
类结构窗口