Lines Matching refs:ch

48         AsynchronousFileChannel ch = AsynchronousFileChannel
52 testUsingCompletionHandlers(ch);
53 testUsingWaitOnResult(ch);
54 testInterruptHandlerThread(ch);
56 ch.close();
60 testClosedChannel(ch);
81 static void testUsingCompletionHandlers(AsynchronousFileChannel ch)
86 ch.truncate(0L);
90 writeFully(ch, src, 0L);
96 readAll(ch, dst, 0L);
114 static void testUsingWaitOnResult(AsynchronousFileChannel ch)
119 ch.truncate(0L);
127 Future<Integer> result = ch.write(src, position);
146 Future<Integer> result = ch.read(dst, position);
171 AsynchronousFileChannel ch = AsynchronousFileChannel
178 fl = ch.lock().get();
184 if (!fl.acquiredBy().equals(ch))
187 ch.tryLock();
194 fl = ch.tryLock();
198 ch.lock((Void)null, new CompletionHandler<FileLock,Void> () {
208 ch.close();
217 static void testInterruptHandlerThread(final AsynchronousFileChannel ch) {
223 ch.read(buf, 0L, (Void)null, new CompletionHandler<Integer,Void>() {
227 long size = ch.size();
242 static void testClosedChannel(AsynchronousFileChannel ch) {
245 if (ch.isOpen())
252 ch.read(buf, 0L).get();
262 ch.write(buf, 0L).get();
272 ch.lock().get();
308 AsynchronousFileChannel ch = AsynchronousFileChannel.open(file, opts, executor);
315 ch.write(genBuffer(), 0L, (Void)null, new CompletionHandler<Integer,Void>() {
339 ch.close();
382 AsynchronousFileChannel ch = AsynchronousFileChannel
388 writeFully(ch, buf, size);
392 ch.close();
394 ch = AsynchronousFileChannel.open(file, WRITE, SYNC);
409 result[i] = ch.write(buf[i], position[i]);
413 ch.close();
440 AsynchronousFileChannel ch = AsynchronousFileChannel
444 Future<Integer> res = ch.write(genBuffer(), 0L);
481 ch.close();
490 AsynchronousFileChannel ch = AsynchronousFileChannel
493 writeFully(ch, genBuffer(), 0L);
494 long size = ch.size();
497 if (ch.truncate(size + 1L).size() != size)
501 if (ch.truncate(size - 1L).size() != (size - 1L))
506 ch.truncate(-1L);
511 ch.close();
516 ch.truncate(0L);
521 ch = AsynchronousFileChannel.open(file, READ);
524 ch.truncate(0L);
528 ch.close();
549 static void writeFully(final AsynchronousFileChannel ch,
556 ch.write(src, position, position, new CompletionHandler<Integer,Long>() {
561 ch.write(src, p, p, this);
574 static void readAll(final AsynchronousFileChannel ch,
581 ch.read(dst, position, position, new CompletionHandler<Integer,Long>() {
586 ch.read(dst, p, p, this);