Code example for FileChannel

Methods: isOpen, size

0
   * persistent storage. (There's no such thing as uninitialized keystone.) 
   *  
   * @param file 
   *          open channel to the underlying file. The file's position is not modified. 
   * @param fileOffset 
   *          the offset at which this keystone begins 
   * @param initValue 
   *          the initial value of the keystone 
   *   
   * @return a {@linkplain KeystoneImpl KeystoneImpl} instance 
   */ 
  public static Keystone createInstance(FileChannel file, long offset, long initValue) throws IOException {
    return new KeystoneImpl(file, offset, initValue);
  } 
   
   
 
  /** 
   * Returns the byte-width of this keystone structure.] 
   */ 
  public abstract int size(); 
 
 
  /** 
   * Returns the current value. 
   */ 
  public abstract long get() throws IOException; 
 
 
  /** 
   * Puts (writes) the given value and returns the old value. This is equivalent 
   * to {@linkplain #put(long, boolean) put(value, false)}. 
   *  
   * @param value 
   *          the new value 
   * @return the old value 
   */ 
  public long set(long value) throws IOException {
    return put(value, false);
  } 
 
 
  /** 
   * Puts (writes) the given value and returns the old value. This is the same 
   * as {@linkplain #set(long)} except it gives the user the option to half the 
   * number of forces to the backing storage device, if this method is to be 
   * invoked very many times in succession in a batch job. 
   *  
   * @param value