javax.rad.io
Class RemoteFileHandle

java.lang.Object
  extended by javax.rad.io.RemoteFileHandle
All Implemented Interfaces:
java.io.Serializable, IFileHandle

public class RemoteFileHandle
extends java.lang.Object
implements IFileHandle, java.io.Serializable

The RemoteFileHandle handles data that is stored in the ObjectCache. Supported Objects are java.io.File, java.net.URL, javax.rad.io.IFileHandle and byte[]. The Bean standard guarantees with the properties "fileName" and "objectCacheKey" that it can be transported with a connection. The Creator of the ObjectCacheHandle has to guarantee that the data is available under the given key. For compatibility reasons is the ObjectCacheHandle also serializable.

See Also:
Serialized Form

Constructor Summary
RemoteFileHandle()
          Constructs a new FileHandle.
RemoteFileHandle(java.io.File pContent)
          Constructs a new FileHandle with the given file as content.
RemoteFileHandle(java.lang.String pFileName)
          Constructs a new FileHandle.
RemoteFileHandle(java.lang.String pFileName, java.io.InputStream pContent)
          Constructs a new FileHandle.
RemoteFileHandle(java.lang.String pFileName, java.lang.Object pObjectCacheKey)
          Constructs a new FileHandle.
RemoteFileHandle(java.lang.String pFileName, java.lang.Object pObjectCacheKey, java.io.InputStream pContent)
          Constructs a new FileHandle.
RemoteFileHandle(java.lang.String pFileName, java.lang.Object pObjectCacheKey, java.net.URL pContent)
          Constructs a new FileHandle.
RemoteFileHandle(java.lang.String pFileName, java.net.URL pContent)
          Constructs a new FileHandle.
 
Method Summary
static java.lang.Object createObjectCacheKey()
          Gets the access key for the object.
protected  void finalize()
          
 java.lang.String getFileName()
          Gets the file name of this file handle.
 java.io.InputStream getInputStream()
          Gets the InputStream of this file handle.
 long getLength()
          Gets the length of the InputStream in bytes
 java.lang.Object getObjectCacheKey()
          Gets the ObjectCache key.
 java.io.OutputStream getOutputStream()
          Resets the content to zero, and gets an OutputStresm to write the content.
 long getTimeout()
          Gets the ObjectCache key.
 void setContent(byte[] pContent)
          Sets a new content with a byte array.
 void setContent(java.io.File pContent)
          Sets a new content with a File.
 void setContent(java.io.InputStream pContent)
          Sets a new content with a InputStream.
 void setContent(java.net.URL pContent)
          Sets a new content with a URL.
 void setFileName(java.lang.String pFileName)
          Sets the file name of this file handle.
 void setObjectCacheKey(java.lang.Object pObjectCacheKey)
          Sets the ObjectCache key.
 void setTimeout(long pTimeout)
          Sets the ObjectCache key.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemoteFileHandle

public RemoteFileHandle()
Constructs a new FileHandle.


RemoteFileHandle

public RemoteFileHandle(java.lang.String pFileName)
Constructs a new FileHandle.

Parameters:
pFileName - the file name.

RemoteFileHandle

public RemoteFileHandle(java.lang.String pFileName,
                        java.lang.Object pObjectCacheKey)
Constructs a new FileHandle.

Parameters:
pFileName - the filename.
pObjectCacheKey - the ObjectCache key.

RemoteFileHandle

public RemoteFileHandle(java.lang.String pFileName,
                        java.net.URL pContent)
Constructs a new FileHandle.

Parameters:
pFileName - the filename.
pContent - the content.

RemoteFileHandle

public RemoteFileHandle(java.lang.String pFileName,
                        java.lang.Object pObjectCacheKey,
                        java.net.URL pContent)
Constructs a new FileHandle.

Parameters:
pFileName - the filename.
pObjectCacheKey - the ObjectCache key.
pContent - the content.

RemoteFileHandle

public RemoteFileHandle(java.lang.String pFileName,
                        java.io.InputStream pContent)
                 throws java.io.IOException
Constructs a new FileHandle.

Parameters:
pFileName - the filename.
pContent - the content.
Throws:
java.io.IOException - if an IOException occurs.

RemoteFileHandle

public RemoteFileHandle(java.lang.String pFileName,
                        java.lang.Object pObjectCacheKey,
                        java.io.InputStream pContent)
                 throws java.io.IOException
Constructs a new FileHandle.

Parameters:
pFileName - the filename.
pObjectCacheKey - the ObjectCache key.
pContent - the content.
Throws:
java.io.IOException - if an IOException occurs.

RemoteFileHandle

public RemoteFileHandle(java.io.File pContent)
Constructs a new FileHandle with the given file as content.

Parameters:
pContent - the content.
Method Detail

getFileName

public java.lang.String getFileName()
Gets the file name of this file handle.

Specified by:
getFileName in interface IFileHandle
Returns:
the file name of this file handle.

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Gets the InputStream of this file handle.

Specified by:
getInputStream in interface IFileHandle
Returns:
the InputStream of this file handle.
Throws:
java.io.IOException - if an exception occurs.

getLength

public long getLength()
               throws java.io.IOException
Gets the length of the InputStream in bytes. -1 is returned if getInputStream is null.

Specified by:
getLength in interface IFileHandle
Returns:
the length of the InputStream in bytes.
Throws:
java.io.IOException - if an exception occurs.

finalize

protected void finalize()
                 throws java.lang.Throwable

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

createObjectCacheKey

public static java.lang.Object createObjectCacheKey()
Gets the access key for the object.

Returns:
the access key for the object

setFileName

public void setFileName(java.lang.String pFileName)
Sets the file name of this file handle.

Parameters:
pFileName - the file name of this file handle.

getObjectCacheKey

public java.lang.Object getObjectCacheKey()
Gets the ObjectCache key.

Returns:
the ObjectCache key.

setObjectCacheKey

public void setObjectCacheKey(java.lang.Object pObjectCacheKey)
Sets the ObjectCache key.

Parameters:
pObjectCacheKey - the ObjectCache key.

getTimeout

public long getTimeout()
Gets the ObjectCache key.

Returns:
the ObjectCache key.

setTimeout

public void setTimeout(long pTimeout)
Sets the ObjectCache key.

Parameters:
pTimeout - the ObjectCache key.

getOutputStream

public java.io.OutputStream getOutputStream()
                                     throws java.io.IOException
Resets the content to zero, and gets an OutputStresm to write the content. The content is stored temporary with the configured timeout.

Returns:
an OutputStresm to write the content.
Throws:
java.io.IOException - if an IOException occurs.

setContent

public void setContent(byte[] pContent)
                throws java.io.IOException
Sets a new content with a byte array. The content is stored temporary with the configured timeout.

Parameters:
pContent - the new content.
Throws:
java.io.IOException - if an IOException occurs.

setContent

public void setContent(java.io.InputStream pContent)
                throws java.io.IOException
Sets a new content with a InputStream. The content is stored temporary with the configured timeout.

Parameters:
pContent - the new content.
Throws:
java.io.IOException - if an IOException occurs.

setContent

public void setContent(java.io.File pContent)
Sets a new content with a File. The content is stored temporary with the configured timeout.

Parameters:
pContent - the new content.

setContent

public void setContent(java.net.URL pContent)
Sets a new content with a URL. The content is stored temporary with the configured timeout.

Parameters:
pContent - the new content.


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.