本文整理汇总了Java中com.koushikdutta.async.future.TransformFuture类的典型用法代码示例。如果您正苦于以下问题:Java TransformFuture类的具体用法?Java TransformFuture怎么用?Java TransformFuture使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TransformFuture类属于com.koushikdutta.async.future包,在下文中一共展示了TransformFuture类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: parse
import com.koushikdutta.async.future.TransformFuture; //导入依赖的package包/类
@Override
public Future<String> parse(DataEmitter emitter) {
final String charset = emitter.charset();
return new ByteBufferListParser().parse(emitter)
.then(new TransformFuture<String, ByteBufferList>() {
@Override
protected void transform(ByteBufferList result) throws Exception {
Charset charsetToUse = forcedCharset;
if (charsetToUse == null && charset != null)
charsetToUse = Charset.forName(charset);
setComplete(result.readString(charsetToUse));
}
});
}
开发者ID:jacklongway,项目名称:LiteSDK,代码行数:15,代码来源:StringParser.java
示例2: parse
import com.koushikdutta.async.future.TransformFuture; //导入依赖的package包/类
@Override
public Future<JSONObject> parse(DataEmitter emitter) {
return new StringParser().parse(emitter)
.then(new TransformFuture<JSONObject, String>() {
@Override
protected void transform(String result) throws Exception {
setComplete(new JSONObject(result));
}
});
}
开发者ID:jacklongway,项目名称:LiteSDK,代码行数:11,代码来源:JSONObjectParser.java
示例3: parse
import com.koushikdutta.async.future.TransformFuture; //导入依赖的package包/类
@Override
public Future<Document> parse(DataEmitter emitter) {
return new ByteBufferListParser().parse(emitter)
.then(new TransformFuture<Document, ByteBufferList>() {
@Override
protected void transform(ByteBufferList result) throws Exception {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
setComplete(db.parse(new ByteBufferListInputStream(result)));
}
});
}
开发者ID:jacklongway,项目名称:LiteSDK,代码行数:13,代码来源:DocumentParser.java
示例4: parse
import com.koushikdutta.async.future.TransformFuture; //导入依赖的package包/类
@Override
public Future<JSONArray> parse(DataEmitter emitter) {
return new StringParser().parse(emitter)
.then(new TransformFuture<JSONArray, String>() {
@Override
protected void transform(String result) throws Exception {
setComplete(new JSONArray(result));
}
});
}
开发者ID:jacklongway,项目名称:LiteSDK,代码行数:11,代码来源:JSONArrayParser.java
示例5: getByName
import com.koushikdutta.async.future.TransformFuture; //导入依赖的package包/类
public Future<InetAddress> getByName(String host) {
return getAllByName(host)
.then(new TransformFuture<InetAddress, InetAddress[]>() {
@Override
protected void transform(InetAddress[] result) throws Exception {
setComplete(result[0]);
}
});
}
开发者ID:jacklongway,项目名称:LiteSDK,代码行数:10,代码来源:AsyncServer.java
示例6: parse
import com.koushikdutta.async.future.TransformFuture; //导入依赖的package包/类
@Override
public Future<String> parse(DataEmitter emitter) {
return new TransformFuture<String, ByteBufferList>() {
@Override
protected void transform(ByteBufferList result) throws Exception {
setComplete(result.readString());
}
}
.from(new ByteBufferListParser().parse(emitter));
}
开发者ID:xiaoshutong,项目名称:AndroidNio,代码行数:11,代码来源:StringParser.java
示例7: parse
import com.koushikdutta.async.future.TransformFuture; //导入依赖的package包/类
@Override
public Future<JSONObject> parse(DataEmitter emitter) {
return new TransformFuture<JSONObject, String>() {
@Override
protected void transform(String result) throws Exception {
setComplete(new JSONObject(result));
}
}
.from(new StringParser().parse(emitter));
}
开发者ID:xiaoshutong,项目名称:AndroidNio,代码行数:11,代码来源:JSONObjectParser.java
示例8: parse
import com.koushikdutta.async.future.TransformFuture; //导入依赖的package包/类
@Override
public Future<Document> parse(DataEmitter emitter) {
return new TransformFuture<Document, ByteBufferList>() {
@Override
protected void transform(ByteBufferList result) throws Exception {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
setComplete(db.parse(new ByteBufferListInputStream(result)));
}
}
.from(new ByteBufferListParser().parse(emitter));
}
开发者ID:xiaoshutong,项目名称:AndroidNio,代码行数:13,代码来源:DocumentParser.java
示例9: parse
import com.koushikdutta.async.future.TransformFuture; //导入依赖的package包/类
@Override
public Future<JSONArray> parse(DataEmitter emitter) {
return new TransformFuture<JSONArray, String>() {
@Override
protected void transform(String result) throws Exception {
setComplete(new JSONArray(result));
}
}
.from(new StringParser().parse(emitter));
}
开发者ID:xiaoshutong,项目名称:AndroidNio,代码行数:11,代码来源:JSONArrayParser.java
示例10: connectSocket
import com.koushikdutta.async.future.TransformFuture; //导入依赖的package包/类
public Cancellable connectSocket(final InetSocketAddress remote, final ConnectCallback callback) {
if (!remote.isUnresolved())
return connectResolvedInetSocketAddress(remote, callback);
return new TransformFuture<AsyncSocket, InetAddress>() {
@Override
protected void transform(InetAddress result) throws Exception {
setParent(connectResolvedInetSocketAddress(new InetSocketAddress(remote.getHostName(), remote.getPort()), callback));
}
}.from(getByName(remote.getHostName()));
}
开发者ID:xiaoshutong,项目名称:AndroidNio,代码行数:12,代码来源:AsyncServer.java
示例11: getByName
import com.koushikdutta.async.future.TransformFuture; //导入依赖的package包/类
public Future<InetAddress> getByName(String host) {
return new TransformFuture<InetAddress, InetAddress[]>() {
@Override
protected void transform(InetAddress[] result) throws Exception {
setComplete(result[0]);
}
}.from(getAllByName(host));
}
开发者ID:xiaoshutong,项目名称:AndroidNio,代码行数:9,代码来源:AsyncServer.java
示例12: parse
import com.koushikdutta.async.future.TransformFuture; //导入依赖的package包/类
@Override
public Future<SearchResult> parse(DataEmitter emitter) {
return new StringParser().parse(emitter)
.then(new TransformFuture<SearchResult, String>() {
@Override
protected void transform(String result) throws Exception {
setComplete(parseXMLResponse(result, tags, pageOffset));
}
});
}
开发者ID:tjg1,项目名称:norilib,代码行数:11,代码来源:DanbooruLegacy.java
注:本文中的com.koushikdutta.async.future.TransformFuture类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论