ucar.nc2.util.cache
Class FileCacheRaf.Raf

java.lang.Object
  extended by ucar.nc2.util.cache.FileCacheRaf.Raf
All Implemented Interfaces:
FileCacheable
Enclosing class:
FileCacheRaf

public class FileCacheRaf.Raf
extends Object
implements FileCacheable


Method Summary
 void close()
          Close the FileCacheable, release all resources.
 String getLocation()
          The location of the FileCacheable, used only for debug and log messages.
 RandomAccessFile getRaf()
           
 void setFileCache(FileCache fileCache)
          If the FileCache is set, the FileCacheable object must store it and call FileCache.release() on FileCacheable.close():
 boolean sync()
          Sync() is called when the FileCacheable is found in the cache, before returning the object to the application.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getLocation

public String getLocation()
Description copied from interface: FileCacheable
The location of the FileCacheable, used only for debug and log messages.

Specified by:
getLocation in interface FileCacheable
Returns:
location

getRaf

public RandomAccessFile getRaf()

close

public void close()
           throws IOException
Description copied from interface: FileCacheable
Close the FileCacheable, release all resources. Also must honor contract with setFileCache().

Specified by:
close in interface FileCacheable
Throws:
IOException

sync

public boolean sync()
             throws IOException
Description copied from interface: FileCacheable
Sync() is called when the FileCacheable is found in the cache, before returning the object to the application. FileCacheable has an opportunity to freshen itself. FileCacheable mag ignore this call.

Specified by:
sync in interface FileCacheable
Returns:
true if FileCacheable was changed
Throws:
IOException - on i/o error.

setFileCache

public void setFileCache(FileCache fileCache)
Description copied from interface: FileCacheable
If the FileCache is set, the FileCacheable object must store it and call FileCache.release() on FileCacheable.close():
  public synchronized void close() throws java.io.IOException {
    if (isClosed) return;
    if (cache != null) {
      cache.release(this);
    } else {
      reallyClose();
    }
    isClosed = true;
   

Specified by:
setFileCache in interface FileCacheable
Parameters:
fileCache - must store this, use it on close as above.


Copyright © 1999-2011 UCAR/Unidata. All Rights Reserved.