org.millstone.base.terminal
Class StreamResource

java.lang.Object
  |
  +--org.millstone.base.terminal.StreamResource
All Implemented Interfaces:
ApplicationResource, Resource

public class StreamResource
extends java.lang.Object
implements ApplicationResource

Stream resource is a resource provided to the client directly by the application. The strean resource is fetched from URI that is most often in the context of the application or window. The resource is automatically registered to window in creation.

Since:
3.0
Version:
3.0.3
Author:
IT Mill Ltd.

Nested Class Summary
static interface StreamResource.StreamSource
          Interface implemented by the source of a StreamResource.
 
Field Summary
 
Fields inherited from interface org.millstone.base.terminal.ApplicationResource
DEFAULT_CACHETIME
 
Constructor Summary
StreamResource(StreamResource.StreamSource streamSource, java.lang.String filename, Application application)
          Create new stream resource for downloading from stream.
 
Method Summary
 Application getApplication()
          Get the application of the resource
 int getBufferSize()
          Get the size of the download buffer used for this resource.
 long getCacheTime()
          Get lenght of cache expiracy time.
 java.lang.String getFilename()
          Returns the filename.
 java.lang.String getMIMEType()
          Get the MIME type of the resource.
 DownloadStream getStream()
          Get resource as stream
 StreamResource.StreamSource getStreamSource()
          Returns the source for this StreamResource.
 void setBufferSize(int bufferSize)
          Set the size of the download buffer used for this resource.
 void setCacheTime(long cacheTime)
          Set lenght of cache expiracy time.
 void setFilename(java.lang.String filename)
          Sets the filename.
 void setMIMEType(java.lang.String MIMEType)
          Set the mime type of the resource
 void setStreamSource(StreamResource.StreamSource streamSource)
          Sets the source for this StreamResource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StreamResource

public StreamResource(StreamResource.StreamSource streamSource,
                      java.lang.String filename,
                      Application application)
Create new stream resource for downloading from stream.

Method Detail

getMIMEType

public java.lang.String getMIMEType()
Description copied from interface: Resource
Get the MIME type of the resource.

Specified by:
getMIMEType in interface Resource

setMIMEType

public void setMIMEType(java.lang.String MIMEType)
Set the mime type of the resource


getStreamSource

public StreamResource.StreamSource getStreamSource()
Returns the source for this StreamResource. StreamSource is queried when the resource is about to be streamed to the client.

Returns:
Source of the StreamResource.

setStreamSource

public void setStreamSource(StreamResource.StreamSource streamSource)
Sets the source for this StreamResource. StreamSource is queried when the resource is about to be streamed to the client.

Parameters:
streamSource - The source to set

getFilename

public java.lang.String getFilename()
Returns the filename.

Specified by:
getFilename in interface ApplicationResource
Returns:
String

setFilename

public void setFilename(java.lang.String filename)
Sets the filename.

Parameters:
filename - The filename to set

getApplication

public Application getApplication()
Description copied from interface: ApplicationResource
Get the application of the resource

Specified by:
getApplication in interface ApplicationResource
See Also:
ApplicationResource.getApplication()

getStream

public DownloadStream getStream()
Description copied from interface: ApplicationResource
Get resource as stream

Specified by:
getStream in interface ApplicationResource
See Also:
ApplicationResource.getStream()

getBufferSize

public int getBufferSize()
Description copied from interface: ApplicationResource
Get the size of the download buffer used for this resource.

If the buffer size is 0, the buffer size is decided by the terminal adapter. The default value is 0.

Specified by:
getBufferSize in interface ApplicationResource
Returns:
int The size of the buffer in bytes.

setBufferSize

public void setBufferSize(int bufferSize)
Set the size of the download buffer used for this resource.

Parameters:
bufferSize - The size of the buffer in bytes.

getCacheTime

public long getCacheTime()
Description copied from interface: ApplicationResource
Get lenght of cache expiracy time.

This gives the adapter the possibility cache streams sent to the client. The caching may be made in adapter or at the client if the client supports caching. Default is DEFAULT_CACHETIME.

Specified by:
getCacheTime in interface ApplicationResource
Returns:
Cache time in milliseconds

setCacheTime

public void setCacheTime(long cacheTime)
Set lenght of cache expiracy time.

This gives the adapter the possibility cache streams sent to the client. The caching may be made in adapter or at the client if the client supports caching. Zero or negavive value disbales the caching of this stream.

Parameters:
cacheTime - The cache time in milliseconds.


Copyright © 2000,2001,2002 IT Mill Ltd. All Rights Reserved.