org.neociclo.odetteftp.protocol.data
Class AbstractMapping

java.lang.Object
  extended by org.neociclo.odetteftp.protocol.data.AbstractMapping
All Implemented Interfaces:
MappingStrategy
Direct Known Subclasses:
CompressionMapping, NormalMapping

public abstract class AbstractMapping
extends Object
implements MappingStrategy

Version:
$Rev: 459 $ $Date: 2010-07-02 06:33:44 -0300 (Fri, 02 Jul 2010) $
Author:
Rafael Marins

Field Summary
static int DEFAULT_VIRTUAL_FILE_BLOCK_SIZE
          Default file block length in octets.
protected static byte[] LINE_SEPARATOR
           
static int MAX_SUBRECORD_LENGTH
           
static int TEXTFILE_BLOCK_SIZE
           
 
Constructor Summary
AbstractMapping()
           
 
Method Summary
protected  void discardReadBytes(FileChannel in, int discardedBytes)
           
static AbstractMapping getInstance(OdetteFtpVersion version, boolean compression, RecordFormat recordFormat)
           
protected  long position(FileChannel in)
           
protected  int read(FileChannel in, ByteBuffer buffer)
           
abstract  boolean readData(VirtualFile virtualFile, FileChannel fileChannel, DataExchangeBuffer dataBuffer)
           
protected  void skip(FileChannel in, int bytes)
           
abstract  long writeData(VirtualFile virtualFile, DataExchangeBuffer dataBuffer, FileChannel fileChannel)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_VIRTUAL_FILE_BLOCK_SIZE

public static final int DEFAULT_VIRTUAL_FILE_BLOCK_SIZE
Default file block length in octets.

See Also:
Constant Field Values

TEXTFILE_BLOCK_SIZE

public static final int TEXTFILE_BLOCK_SIZE
See Also:
Constant Field Values

MAX_SUBRECORD_LENGTH

public static final int MAX_SUBRECORD_LENGTH
See Also:
Constant Field Values

LINE_SEPARATOR

protected static final byte[] LINE_SEPARATOR
Constructor Detail

AbstractMapping

public AbstractMapping()
Method Detail

getInstance

public static AbstractMapping getInstance(OdetteFtpVersion version,
                                          boolean compression,
                                          RecordFormat recordFormat)

readData

public abstract boolean readData(VirtualFile virtualFile,
                                 FileChannel fileChannel,
                                 DataExchangeBuffer dataBuffer)
                          throws OdetteFtpException
Specified by:
readData in interface MappingStrategy
Returns:
true reach end of the stream (EOF).
Throws:
OdetteFtpException

writeData

public abstract long writeData(VirtualFile virtualFile,
                               DataExchangeBuffer dataBuffer,
                               FileChannel fileChannel)
                        throws OdetteFtpException
Specified by:
writeData in interface MappingStrategy
Throws:
OdetteFtpException

position

protected long position(FileChannel in)
                 throws VirtualFileMappingException
Throws:
VirtualFileMappingException

skip

protected void skip(FileChannel in,
                    int bytes)
             throws VirtualFileMappingException
Throws:
VirtualFileMappingException

discardReadBytes

protected void discardReadBytes(FileChannel in,
                                int discardedBytes)
                         throws VirtualFileMappingException
Throws:
VirtualFileMappingException

read

protected int read(FileChannel in,
                   ByteBuffer buffer)
            throws VirtualFileMappingException
Throws:
VirtualFileMappingException


ACCORD