Code example for FileChannel

Methods: lockread

0
 
    long pos = id * BYTES_PER_MINTHUMB;
    FileLock lock = null;
    try { 
      mBuffer.clear();
      lock = mChannel.lock(pos, BYTES_PER_MINTHUMB, true);
      int size = mChannel.read(mBuffer, pos);
      if (size > 1 + 8 + 4) {
        mBuffer.position(9);
        int length = mBuffer.getInt();
 
        if (size >= 1 + 8 + 4 + length && data.length >= length) {
          mBuffer.get(data, 0, length);
          return data;
        } 
      } 
    } catch (IOException ex) {
    } catch (RuntimeException ex) {
    } finally { 
      try { 
Connect your IDE to all the code out there  Get Codota for Java