AdroitLogic UltraESB v1.7.0

org.adroitlogic.ultraesb.api
Class MessageFile

java.lang.Object
  extended by java.io.File
      extended by org.adroitlogic.ultraesb.api.MessageFile
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable

public class MessageFile
extends java.io.File

This is the default implementation of a temporary file, created and managed by a FileCache implementation Although this class extends java.io.File, only the specific constructor that passes the FileCache should be used The implementation supports arbitrarily large messages backed by a File. However, the file comes into play only if required, as the first chunk of data is either memory mapped or held in a direct ByteBuffer. This is transparent to the user, and if the message size exceeds the ByteBuffer, the payload is transparently moved to the file.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.io.File
pathSeparator, pathSeparatorChar, separator, separatorChar
 
Constructor Summary
MessageFile(java.io.File parent, java.lang.String child)
           
MessageFile(java.io.File directory, java.lang.String fileName, long id, boolean memoryMapped, int bufferSize, FileCache fileCache)
           
MessageFile(java.io.File directory, java.lang.String fileName, long id, boolean memoryMapped, int bufferSize, FileCache fileCache, boolean reusable)
           
MessageFile(java.lang.String pathname)
           
MessageFile(java.lang.String parent, java.lang.String child)
           
MessageFile(java.net.URI uri)
           
 
Method Summary
 void destroy()
           
 boolean equals(java.lang.Object o)
           
 long getId()
           
 java.io.OutputStream getOutputStream()
           
 int hashCode()
           
 boolean isReusable()
           
 long length()
           
 java.nio.channels.FileChannel openFileChannel()
          Always position the file pointer to the start of the file and returns a FileChannel
 void release()
           
 void reset()
          Reset resources before reuse
 void saveFileLength()
          If the length is virtual to the file, save it so that the OS will see the correct length (Use when passing a File to FastXML etc)
 void setLength(long length)
          Set known length of file as an optimization to avoid file meta data check
 
Methods inherited from class java.io.File
canExecute, canRead, canWrite, compareTo, createNewFile, createTempFile, createTempFile, delete, deleteOnExit, exists, getAbsoluteFile, getAbsolutePath, getCanonicalFile, getCanonicalPath, getFreeSpace, getName, getParent, getParentFile, getPath, getTotalSpace, getUsableSpace, isAbsolute, isDirectory, isFile, isHidden, lastModified, list, list, listFiles, listFiles, listFiles, listRoots, mkdir, mkdirs, renameTo, setExecutable, setExecutable, setLastModified, setReadable, setReadable, setReadOnly, setWritable, setWritable, toString, toURI, toURL
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MessageFile

public MessageFile(java.io.File directory,
                   java.lang.String fileName,
                   long id,
                   boolean memoryMapped,
                   int bufferSize,
                   FileCache fileCache)

MessageFile

public MessageFile(java.io.File directory,
                   java.lang.String fileName,
                   long id,
                   boolean memoryMapped,
                   int bufferSize,
                   FileCache fileCache,
                   boolean reusable)

MessageFile

public MessageFile(java.lang.String pathname)

MessageFile

public MessageFile(java.lang.String parent,
                   java.lang.String child)

MessageFile

public MessageFile(java.io.File parent,
                   java.lang.String child)

MessageFile

public MessageFile(java.net.URI uri)
Method Detail

reset

public void reset()
           throws java.io.IOException
Reset resources before reuse

Throws:
java.io.IOException

release

public void release()

getId

public long getId()

isReusable

public boolean isReusable()

getOutputStream

public java.io.OutputStream getOutputStream()

openFileChannel

public java.nio.channels.FileChannel openFileChannel()
Always position the file pointer to the start of the file and returns a FileChannel

Returns:
a FileChannel to the underlying file, positioned to the start of the file

setLength

public void setLength(long length)
Set known length of file as an optimization to avoid file meta data check

Parameters:
length - known length of file

saveFileLength

public void saveFileLength()
If the length is virtual to the file, save it so that the OS will see the correct length (Use when passing a File to FastXML etc)


length

public long length()
Overrides:
length in class java.io.File

destroy

public void destroy()

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.io.File

hashCode

public int hashCode()
Overrides:
hashCode in class java.io.File

Copyright (c) 2010-2012 AdroitLogic Private Ltd. All rights reserved.