本文整理了Java中com.sun.grizzly.util.Utils.findBytes()
方法的一些代码示例,展示了Utils.findBytes()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.findBytes()
方法的具体详情如下:
包路径:com.sun.grizzly.util.Utils
类名称:Utils
方法名:findBytes
[英]Specialized utility method: find a sequence of lower case bytes inside a ByteBuffer.
[中]专门的实用方法:在字节缓冲区中查找小写字节序列。
代码示例来源:origin: com.sun.grizzly/grizzly-http
/**
* Introspect the request and determine if the target url can
* execute under {@link AsyncHandler} or not.
* @param bb The current byteBuffer.
* @param handlerCode - no used.
* @return An {@link Interceptor} value determining if an {@link AsyncHandler}
* should be allowed to execute or not.
* @throws java.io.IOException
*/
public int handle(ByteBuffer bb, int handlerCode) throws IOException {
int pos = bb.position();
int limit = bb.limit();
try{
// TODO: Add patten matching.
for (byte[] b: allowed){
if (Utils.findBytes(bb,b) > -1){
return Interceptor.CONTINUE;
}
}
} finally {
bb.position(pos);
bb.limit(limit);
}
return Interceptor.BREAK;
}
代码示例来源:origin: org.glassfish.external/grizzly-module
while(iterator.hasNext()){
matchBytes = iterator.next();
if (Utils.findBytes(bb,matchBytes) > -1){
log("Find match: " + (new String(matchBytes))
+ " Suspending: " + ctx.getSelectionKey());
内容来源于网络,如有侵权,请联系作者删除!