溫少的日志
導航
BlogJava
首頁
新隨筆
聯系
聚合
管理
<
2007年4月
>
日
一
二
三
四
五
六
25
26
27
28
29
30
31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
1
2
3
4
5
統計
隨筆 - 75
文章 - 0
評論 - 168
引用 - 0
常用鏈接
我的隨筆
我的評論
我的參與
最新評論
留言簿
(14)
給我留言
查看公開留言
查看私人留言
隨筆檔案
2010年7月 (1)
2009年9月 (3)
2009年1月 (1)
2008年7月 (1)
2008年6月 (1)
2008年5月 (1)
2008年3月 (1)
2008年2月 (2)
2007年11月 (3)
2007年9月 (3)
2007年5月 (2)
2007年4月 (8)
2007年3月 (6)
2006年11月 (15)
2006年7月 (8)
2006年4月 (1)
2006年3月 (1)
2006年1月 (2)
2005年4月 (1)
2005年3月 (5)
2005年2月 (1)
2005年1月 (2)
2004年12月 (3)
2004年11月 (2)
2004年10月 (1)
鏈接
溫少的日志(主站)
搜索
最新評論
1.?re: 使用bcel動態創建class
謝謝樓主的分享 支持一下
--長春慶典公司
2.?re: 精巧好用的DelayQueue
評論內容較長,點擊標題查看
--chun
3.?re: 使用bcel動態創建class
寫的很詳細很實用
--吉林網站升級
4.?re: 使用bcel動態創建class
謝謝博主無私的分享
--長春短租公寓
5.?re: 使用JSON替代XML
很好的方法啊,要記住
--長春日租房
閱讀排行榜
1.?使用bcel動態創建class(8647)
2.?關于java nio在windows下實現(7951)
3.?Java aio和JSR 203(6886)
4.?新寫了一個Java并發程序設計教程(6410)
5.?JDK 在linux下支持epoll了(6363)
評論排行榜
1.?提高編碼速度的一個辦法(25)
2.?JPA這個爛東西(19)
3.?歡迎訪問金蝶“友商網”(www.youshang.com)(13)
4.?也說一種普遍錯誤使用的LOG方式(13)
5.?使用JSON替代XML(12)
JSR 203終于要出來啦
JSR-000203 More New I/O APIs for the Java Platform - Early Draft Review
http://jcp.org/aboutJava/communityprocess/edr/jsr203/index.html
API的Early Draft Review出來了,就意味很快就要真的出來啦!!
以下是其文檔的一個Sample
static
class
IOTransaction {
public
ByteBuffer buffer() {
}
public
long
position() {
}
public
long
updatePosition(
int
transferred) {
}
}
static
class
WriteHandler
implements
CompletionHandler
<
Integer
>
{
public
WriteHandler(AsynchronousFileChannel ch) {
}
private
AsynchronousFileChannel channel() {
}
public
void
completed(IoFuture
<
Integer
>
result) {
int
bytesTransferred;
try
{
bytesTransferred
=
result.getNow();
}
catch
(ExecutionException x) {
}
IOTransaction transaction
=
(IOTransaction)result.attachment();
ByteBuffer buffer
=
transaction.buffer();
if
(buffer.remaining()
>
0
) {
long
position
=
transaction.updatePosition(bytesTransferred);
channel().write(buffer, position, transaction,
this
);
}
}
}
FileReference file
=
List
<
IOTransaction
>
transactionList
=
AsynchronousFileChannel ch
=
AsynchronousFileChannel.open(file, OpenFlag.WRITE);
WriteHandler handler
=
new
WriteHandler(ch);
for
(IOTransaction transaction: transactionList) {
//
use the transaction as the attachment
ch.write(transaction.buffer(), transaction.position(), transaction, handler);
}
就是我最近很需要的東西,一個異步I/O的實現,十分期待中!!
溫少
2007-04-14 12:15
發表評論
posted on 2007-04-14 12:15
溫少的日志
閱讀(268)
評論(0)
編輯
收藏
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發表評論。
網站導航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
Powered by:
BlogJava
Copyright © 溫少的日志
主站蜘蛛池模板:
灵川县
|
泽普县
|
涞源县
|
大连市
|
疏附县
|
仁布县
|
卢龙县
|
鹿邑县
|
三江
|
慈溪市
|
巴塘县
|
普格县
|
织金县
|
专栏
|
阿克苏市
|
蓝山县
|
巴塘县
|
武穴市
|
庐江县
|
滨海县
|
扎兰屯市
|
乌鲁木齐市
|
磴口县
|
瑞丽市
|
集安市
|
安龙县
|
巴林左旗
|
浪卡子县
|
曲靖市
|
武安市
|
枣庄市
|
夹江县
|
怀仁县
|
邵武市
|
会东县
|
丹寨县
|
永善县
|
澜沧
|
岫岩
|
上林县
|
泸水县
|