com.aelitis.azureus.core.diskmanager.file.impl
Class FMFileAccessPieceReorderer

java.lang.Object
  extended by com.aelitis.azureus.core.diskmanager.file.impl.FMFileAccessPieceReorderer
All Implemented Interfaces:
FMFileAccess

public class FMFileAccessPieceReorderer
extends Object
implements FMFileAccess


Constructor Summary
protected FMFileAccessPieceReorderer(TOTorrentFile _torrent_file, File _control_dir, String _control_file, int _storage_type, FMFileAccess _delegate)
           
 
Method Summary
 void aboutToOpen()
           
 void flush()
           
 FMFileImpl getFile()
           
 long getLength(RandomAccessFile raf)
           
protected  int getPieceIndex(RandomAccessFile raf, int piece_number, boolean allocate_if_needed)
           
protected  long getPieceOffset(RandomAccessFile raf, int piece_number, boolean allocate_if_needed)
           
 String getString()
           
 boolean isPieceCompleteProcessingNeeded(int piece_number)
           
 void read(RandomAccessFile raf, DirectByteBuffer[] buffers, long position)
           
protected  void readWrite(RandomAccessFile raf, DirectByteBuffer[] buffers, long position, boolean is_read)
           
protected  int readWritePiece(RandomAccessFile raf, DirectByteBuffer[] buffers, int piece_number, int piece_offset, boolean is_read)
           
protected static void recoverConfig(TOTorrentFile torrent_file, File data_file, File config_file, int storage_type)
           
protected  void setDirty()
           
 void setLength(RandomAccessFile raf, long length)
           
 void setPieceComplete(RandomAccessFile raf, int piece_number, DirectByteBuffer piece_data)
           
 void write(RandomAccessFile raf, DirectByteBuffer[] buffers, long position)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FMFileAccessPieceReorderer

protected FMFileAccessPieceReorderer(TOTorrentFile _torrent_file,
                                     File _control_dir,
                                     String _control_file,
                                     int _storage_type,
                                     FMFileAccess _delegate)
                              throws FMFileManagerException
Throws:
FMFileManagerException
Method Detail

aboutToOpen

public void aboutToOpen()
                 throws FMFileManagerException
Specified by:
aboutToOpen in interface FMFileAccess
Throws:
FMFileManagerException

getLength

public long getLength(RandomAccessFile raf)
               throws FMFileManagerException
Specified by:
getLength in interface FMFileAccess
Throws:
FMFileManagerException

setLength

public void setLength(RandomAccessFile raf,
                      long length)
               throws FMFileManagerException
Specified by:
setLength in interface FMFileAccess
Throws:
FMFileManagerException

getPieceOffset

protected long getPieceOffset(RandomAccessFile raf,
                              int piece_number,
                              boolean allocate_if_needed)
                       throws FMFileManagerException
Throws:
FMFileManagerException

readWritePiece

protected int readWritePiece(RandomAccessFile raf,
                             DirectByteBuffer[] buffers,
                             int piece_number,
                             int piece_offset,
                             boolean is_read)
                      throws FMFileManagerException
Throws:
FMFileManagerException

readWrite

protected void readWrite(RandomAccessFile raf,
                         DirectByteBuffer[] buffers,
                         long position,
                         boolean is_read)
                  throws FMFileManagerException
Throws:
FMFileManagerException

read

public void read(RandomAccessFile raf,
                 DirectByteBuffer[] buffers,
                 long position)
          throws FMFileManagerException
Specified by:
read in interface FMFileAccess
Throws:
FMFileManagerException

write

public void write(RandomAccessFile raf,
                  DirectByteBuffer[] buffers,
                  long position)
           throws FMFileManagerException
Specified by:
write in interface FMFileAccess
Throws:
FMFileManagerException

flush

public void flush()
           throws FMFileManagerException
Specified by:
flush in interface FMFileAccess
Throws:
FMFileManagerException

isPieceCompleteProcessingNeeded

public boolean isPieceCompleteProcessingNeeded(int piece_number)
Specified by:
isPieceCompleteProcessingNeeded in interface FMFileAccess

setPieceComplete

public void setPieceComplete(RandomAccessFile raf,
                             int piece_number,
                             DirectByteBuffer piece_data)
                      throws FMFileManagerException
Specified by:
setPieceComplete in interface FMFileAccess
Throws:
FMFileManagerException

getPieceIndex

protected int getPieceIndex(RandomAccessFile raf,
                            int piece_number,
                            boolean allocate_if_needed)
                     throws FMFileManagerException
Throws:
FMFileManagerException

setDirty

protected void setDirty()
                 throws FMFileManagerException
Throws:
FMFileManagerException

recoverConfig

protected static void recoverConfig(TOTorrentFile torrent_file,
                                    File data_file,
                                    File config_file,
                                    int storage_type)
                             throws FMFileManagerException
Throws:
FMFileManagerException

getFile

public FMFileImpl getFile()
Specified by:
getFile in interface FMFileAccess

getString

public String getString()
Specified by:
getString in interface FMFileAccess