List of usage examples for org.apache.cassandra.io.util RandomAccessReader readFully
@Override
public void readFully(byte[] b, int off, int len) throws IOException
From source file:com.fullcontact.cassandra.io.util.BufferedRandomAccessFileTest.java
License:Apache License
@Test public void testIsEOF() throws IOException { for (int bufferSize : Arrays.asList(1, 2, 3, 5, 8, 64)) // smaller, equal, bigger buffer sizes {// w w w. ja v a 2s. c o m final byte[] target = new byte[32]; // single too-large read for (final int offset : Arrays.asList(0, 8)) { File file1 = writeTemporaryFile(new byte[16]); final RandomAccessReader file = RandomAccessReader.open(new Path(file1.getPath()), bufferSize, false, null, fs); expectEOF(new Callable<Object>() { public Object call() throws IOException { file.readFully(target, offset, 17); return null; } }); } // first read is ok but eventually EOFs for (final int n : Arrays.asList(1, 2, 4, 8)) { File file1 = writeTemporaryFile(new byte[16]); final RandomAccessReader file = RandomAccessReader.open(new Path(file1.getPath()), bufferSize, false, null, fs); expectEOF(new Callable<Object>() { public Object call() throws IOException { while (true) file.readFully(target, 0, n); } }); } } }