com.onionnetworks.fec.io
Class RAF

java.lang.Object
  |
  +--com.onionnetworks.fec.io.RAF

public class RAF
extends java.lang.Object

This class wraps a RandomAccessFile with synchronization and a more consistant version of renameTo(). (c) Copyright 2001 Onion Networks (c) Copyright 2000 OpenCola


Constructor Summary
RAF(java.io.File f, java.lang.String mode)
           
 
Method Summary
 void close()
           
 java.lang.String getMode()
           
 void renameTo(java.io.File destFile)
          This version of renameTo() attempts to mimic the behavior of the unix 'mv' command rather than File.renameTo.
 void seekAndReadFully(long pos, byte[] b, int off, int len)
           
 void seekAndWrite(long pos, byte[] b, int off, int len)
           
 void setLength(long len)
           
 void setReadOnly()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RAF

public RAF(java.io.File f,
           java.lang.String mode)
    throws java.io.IOException
Method Detail

seekAndWrite

public void seekAndWrite(long pos,
                         byte[] b,
                         int off,
                         int len)
                  throws java.io.IOException

seekAndReadFully

public void seekAndReadFully(long pos,
                             byte[] b,
                             int off,
                             int len)
                      throws java.io.IOException

renameTo

public void renameTo(java.io.File destFile)
              throws java.io.IOException
This version of renameTo() attempts to mimic the behavior of the unix 'mv' command rather than File.renameTo. This means that the destFile will automatically be deleted if it exists and if we are unable to mv the file directly because they are on different file systems then we will manually copy and delete the original. If there is an exception during the copy then we will attempt to delete the new copy and leave the old copy intact.

getMode

public java.lang.String getMode()

setReadOnly

public void setReadOnly()
                 throws java.io.IOException

setLength

public void setLength(long len)
               throws java.io.IOException

close

public void close()
           throws java.io.IOException