org.millstone.base.terminal
Class DownloadStream

java.lang.Object
  |
  +--org.millstone.base.terminal.DownloadStream

public class DownloadStream
extends java.lang.Object

Downloadable stream.

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

Field Summary
static long DEFAULT_CACHETIME
          Default cache time.
static long MAX_CACHETIME
          Maximum cache time.
 
Constructor Summary
DownloadStream(java.io.InputStream stream, java.lang.String contentType, java.lang.String fileName)
          Creates a new instance of DownloadStream
 
Method Summary
 int getBufferSize()
          Get the size of the download buffer.
 long getCacheTime()
          Get lenght of cache expiracy time.
 java.lang.String getContentType()
          Get stream content type.
 java.lang.String getFileName()
          Returns the file name.
 java.lang.String getParameter(java.lang.String name)
          Get a paramater for download stream.
 java.util.Iterator getParameterNames()
          Get the names of the parameters.
 java.io.InputStream getStream()
          Get downloadable stream.
 void setBufferSize(int bufferSize)
          Set the size of the download buffer.
 void setCacheTime(long cacheTime)
          Set lenght of cache expiracy time.
 void setContentType(java.lang.String contentType)
          Set stream content type.
 void setFileName(java.lang.String fileName)
          Sets the file name.
 void setParameter(java.lang.String name, java.lang.String value)
          Set a paramater for download stream.
 void setStream(java.io.InputStream stream)
          Sets the stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_CACHETIME

public static final long MAX_CACHETIME
Maximum cache time.

See Also:
Constant Field Values

DEFAULT_CACHETIME

public static final long DEFAULT_CACHETIME
Default cache time.

See Also:
Constant Field Values
Constructor Detail

DownloadStream

public DownloadStream(java.io.InputStream stream,
                      java.lang.String contentType,
                      java.lang.String fileName)
Creates a new instance of DownloadStream

Method Detail

getStream

public java.io.InputStream getStream()
Get downloadable stream.

Returns:
output stream.

setStream

public void setStream(java.io.InputStream stream)
Sets the stream.

Parameters:
stream - The stream to set

getContentType

public java.lang.String getContentType()
Get stream content type.

Returns:
type of the stream content.

setContentType

public void setContentType(java.lang.String contentType)
Set stream content type.

Parameters:
contentType - The contentType to set

getFileName

public java.lang.String getFileName()
Returns the file name.

Returns:
The name of the file.

setFileName

public void setFileName(java.lang.String fileName)
Sets the file name.

Parameters:
fileName - The file name to set

setParameter

public void setParameter(java.lang.String name,
                         java.lang.String value)
Set a paramater for download stream. Parameters are optional information about the downloadable stream and their meaning depends on the used adapter. For example in WebAdapter they are interpreted as HTTP response headers. If the parameters by this name exists, the old value is replaced.

Parameters:
name - Name of the parameter to set.
value - Value of the parameter to set.

getParameter

public java.lang.String getParameter(java.lang.String name)
Get a paramater for download stream. Parameters are optional information about the downloadable stream and their meaning depends on the used adapter. For example in WebAdapter they are interpreted as HTTP response headers.

Parameters:
name - Name of the parameter to set.
Returns:
Value of the parameter or null if the parameter does not exist.

getParameterNames

public java.util.Iterator getParameterNames()
Get the names of the parameters.

Returns:
Iteraror of names or null if no parameters are set.

getCacheTime

public long getCacheTime()
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.

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.

getBufferSize

public int getBufferSize()
Get the size of the download buffer.

Returns:
int The size of the buffer in bytes.

setBufferSize

public void setBufferSize(int bufferSize)
Set the size of the download buffer.

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


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