Lines Matching refs:fc

57     private static void writeBytes(byte[] ba, FileChannel fc,
61 fc.position(off);
62 if (fc.write(ByteBuffer.wrap(ba, 0, len)) != len)
64 fc.position(0);
68 FileChannel fc, int off, int len)
74 writeBytes(ba, fc, off, len);
77 private static void writeZeroBytes(FileChannel fc, int off, int len)
81 writeBytes(ba, fc, off, len);
84 private static void checkBytes(FileChannel fc, int off, int len,
89 fc.position(off);
90 if (fc.read(bb) != len)
98 private static void checkRandomBytes(FileChannel fc, int off, int len,
105 checkBytes(fc, off, len, ba);
108 private static void checkZeroBytes(FileChannel fc, int off, int len)
112 checkBytes(fc, off, len, ba);
117 private static void dump(FileChannel fc)
120 int sz = (int)fc.size();
122 fc.position(0);
123 if (fc.read(bb) != sz)
201 private final FileChannel fc;
207 fc = raf.getChannel();
208 fc.position(0);
209 writeRandomBytes(seed, fc, 0, size);
213 return fc;
217 if (fc.position() != size)
219 + fc.position() + " (expected " + size +
221 checkRandomBytes(fc, 0, size, seed);
222 fc.close();
299 private final FileChannel fc;
305 fc = raf.getChannel();
306 fc.position(0);
310 return fc;
314 if (fc.position() != size)
316 + fc.position() + " (expected " + size + ")");
317 checkRandomBytes(fc, 0, size, seed);
318 fc.close();
421 static void testTo(long seed, FileChannel fc, int off, int len, Target tgt)
427 writeZeroBytes(fc, 0, MAX_FILE_SIZE);
428 writeRandomBytes(seed, fc, off, len);
432 fc.position(pos);
434 int n = (int)fc.transferTo(off, len, tgt.channel());
440 if (fc.position() != pos)
443 dump(fc);
444 checkRandomBytes(fc, off, len, seed);
445 writeZeroBytes(fc, off, len);
446 checkZeroBytes(fc, 0, MAX_FILE_SIZE);
452 static void testFrom(long seed, Source src, FileChannel fc, int off, int len)
458 writeZeroBytes(fc, 0, MAX_FILE_SIZE);
462 fc.position(pos);
464 int n = (int)fc.transferFrom(src.channel(), off, len);
473 if (fc.position() != pos)
476 dump(fc);
477 checkRandomBytes(fc, off, len, seed);
478 writeZeroBytes(fc, off, len);
479 checkZeroBytes(fc, 0, MAX_FILE_SIZE);
499 FileChannel fc = new RandomAccessFile(fn, "rw").getChannel();
527 testTo(s, fc, off, len, tgt);
536 testFrom(s, src, fc, off, len);