Lines Matching defs:fc

58     private static void writeBytes(byte[] ba, FileChannel fc,
62 fc.position(off);
63 if (fc.write(ByteBuffer.wrap(ba, 0, len)) != len)
65 fc.position(0);
69 FileChannel fc, int off, int len)
75 writeBytes(ba, fc, off, len);
78 private static void writeZeroBytes(FileChannel fc, int off, int len)
82 writeBytes(ba, fc, off, len);
85 private static void checkBytes(FileChannel fc, int off, int len,
90 fc.position(off);
91 if (fc.read(bb) != len)
99 private static void checkRandomBytes(FileChannel fc, int off, int len,
106 checkBytes(fc, off, len, ba);
109 private static void checkZeroBytes(FileChannel fc, int off, int len)
113 checkBytes(fc, off, len, ba);
118 private static void dump(FileChannel fc)
121 int sz = (int)fc.size();
123 fc.position(0);
124 if (fc.read(bb) != sz)
202 private final FileChannel fc;
208 fc = raf.getChannel();
209 fc.position(0);
210 writeRandomBytes(seed, fc, 0, size);
214 return fc;
218 if (fc.position() != size)
220 + fc.position() + " (expected " + size +
222 checkRandomBytes(fc, 0, size, seed);
223 fc.close();
300 private final FileChannel fc;
306 fc = raf.getChannel();
307 fc.position(0);
311 return fc;
315 if (fc.position() != size)
317 + fc.position() + " (expected " + size + ")");
318 checkRandomBytes(fc, 0, size, seed);
319 fc.close();
422 static void testTo(long seed, FileChannel fc, int off, int len, Target tgt)
428 writeZeroBytes(fc, 0, MAX_FILE_SIZE);
429 writeRandomBytes(seed, fc, off, len);
433 fc.position(pos);
435 int n = (int)fc.transferTo(off, len, tgt.channel());
441 if (fc.position() != pos)
444 dump(fc);
445 checkRandomBytes(fc, off, len, seed);
446 writeZeroBytes(fc, off, len);
447 checkZeroBytes(fc, 0, MAX_FILE_SIZE);
453 static void testFrom(long seed, Source src, FileChannel fc, int off, int len)
459 writeZeroBytes(fc, 0, MAX_FILE_SIZE);
463 fc.position(pos);
465 int n = (int)fc.transferFrom(src.channel(), off, len);
474 if (fc.position() != pos)
477 dump(fc);
478 checkRandomBytes(fc, off, len, seed);
479 writeZeroBytes(fc, off, len);
480 checkZeroBytes(fc, 0, MAX_FILE_SIZE);
506 try (FileChannel fc = new RandomAccessFile(fn, "rw").getChannel()) {
530 testTo(s, fc, off, len, tgt);
539 testFrom(s, src, fc, off, len);