Sample 0 [from 76 instances]

Class230.fillBuffer(FileChannel channel,ByteBuffer buf){
    int bytesRead = channel.read(buf);
    if (bytesRead < 0) {
      //EOF
      return bytesRead;
    }
    while (buf.remaining() 0) {
      int n = channel.read(buf);
      if (n < 0) {
        //EOF
        return bytesRead;
      }
      bytesRead += n;
    }
}


Sample 1 [from 60 instances]

Class80.increaseMajor(String cfile,int delta)#2{
            ByteBuffer rbuf = ByteBuffer.allocate(2);
            fc.read(rbuf, 6);
            ByteBuffer wbuf = ByteBuffer.allocate(2);
}


Sample 2 [from 46 instances]

Class440.testReadOnlyByteArrays()#1{
        File tmp = File.createTempFile("FileChannelTest""tmp");
        FileChannel fc = new FileInputStream(tmp).getChannel();
            fc.read(readOnly);
            fc.read(new ByteBuffer[] { readOnly });
            fc.read(new ByteBuffer[] { readOnly }01);
            fc.read(readOnly, 0L);
        fc.close();
}


Sample 3 [from 33 instances]

Class510.readBufferFully(FileChannel fc,ByteBuffer buf,int startPos)#0{
        while (buf.hasRemaining()) {
            int read = fc.read(buf, pos);
            if (read == -1) {
                throw new EOFException();
            }
            pos += read;
        }
        buf.flip();
}


Sample 4 [from 25 instances]

Class180.testThroughLogBuffer()#1{
        dup.readreadInMe );
        readInMe.flip();
        assertEquals2readInMe.getInt() );
        readInMe.flip();
}


Sample 5 [from 13 instances]

Class460.transferTo(FileChannel fc,long pos,long len){
        ByteBuffer buf = ByteBuffer.allocate(bufferSize);
        while((i = fc.read(buf, pos)) != -1) {
          if(i > 0) {
            ret += i;
            pos += i;
            buf.flip();
            write0(buf);
            buf = ByteBuffer.allocate(bufferSize);
          }
//          log.info("write file ret {} | len {}", ret, len);
          if(ret >= len)
            break;
        }
        fc.close();
}


Sample 6 [from 10 instances]

Class30.read(FileChannel fc,SymbolTable symbols){
        final ByteBuffer buffer = ByteBuffer.allocate((intfc.size());
        fc.read(buffer);
        buffer.flip();
        root.read(buffer, symbols);
}


Sample 7 [from 6 instances]

Class130.testXiphLacing()#3{
        FileInputStream fileInputStream = new FileInputStream(file);
        ByteBuffer source = ByteBuffer.allocate(fileInputStream.available());
            FileChannel channel = fileInputStream.getChannel();
            channel.position(be.dataOffset);
            channel.read(source);
            source.flip();
}


Sample 8 [from 6 instances]

Class510.seekAndReadContent(FileChannel source)#0{
        source.position(dataOffset);
        source.read(data);
        this.data.flip();
}


Sample 9 [from 5 instances]

Class390.read(byte[] data,int doff,int length,long offset)#0{
        int read = channel.read(ByteBuffer.wrap(data, doff, length));
}