com.vaadin.terminal.
Class DownloadStream
java.lang.Object
com.vaadin.terminal.DownloadStream
All Implemented Interfaces:
- extends Object
- implements Serializable
public class DownloadStream
Downloadable stream.
Since:
3.0
Version:
6.8.18
Author:
Vaadin Ltd.
See Also:
Field Summary | |
---|---|
static long |
DEFAULT_CACHETIME
Default cache time. |
static long |
MAX_CACHETIME
Maximum cache time. |
Constructor Summary | |
---|---|
DownloadStream(InputStream stream,
String contentType,
String fileName)
Creates a new instance of DownloadStream. |
Method Summary | |
---|---|
int |
getBufferSize()
Gets the size of the download buffer. |
long |
getCacheTime()
Gets length of cache expiration time. |
String |
getContentType()
Gets stream content type. |
String |
getFileName()
Returns the file name. |
String |
getParameter(String name)
Gets a paramater for download stream. |
Iterator<String> |
getParameterNames()
Gets the names of the parameters. |
InputStream |
getStream()
Gets downloadable stream. |
void |
setBufferSize(int bufferSize)
Sets the size of the download buffer. |
void |
setCacheTime(long cacheTime)
Sets length of cache expiration time. |
void |
setContentType(String contentType)
Sets stream content type. |
void |
setFileName(String fileName)
Sets the file name. |
void |
setParameter(String name,
String value)
Sets a paramater for download stream. |
void |
setStream(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
- See Also:
- Constant Field Values
Maximum cache time.
DEFAULT_CACHETIME
public static final long DEFAULT_CACHETIME
- See Also:
- Constant Field Values
Default cache time.
Constructor Detail |
---|
DownloadStream
public DownloadStream(InputStream stream,
String contentType,
String fileName)
Creates a new instance of DownloadStream.
Method Detail |
---|
getStream
public InputStream getStream()
- Returns:
- output stream.
Gets downloadable stream.
setStream
public void setStream(InputStream stream)
- Parameters:
stream
- The stream to set
Sets the stream.
getContentType
public String getContentType()
- Returns:
- type of the stream content.
Gets stream content type.
setContentType
public void setContentType(String contentType)
- Parameters:
contentType
- the contentType to set
Sets stream content type.
getFileName
public String getFileName()
- Returns:
- the name of the file.
Returns the file name.
setFileName
public void setFileName(String fileName)
- Parameters:
fileName
- the file name to set.
Sets the file name.
setParameter
public void setParameter(String name,
String value)
- Parameters:
name
- the Name of the parameter to set.value
- the Value of the parameter to set.
Sets 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.
getParameter
public String getParameter(String name)
- Parameters:
name
- the Name of the parameter to set.- Returns:
- Value of the parameter or null if the parameter does not exist.
Gets 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.
getParameterNames
public Iterator<String> getParameterNames()
- Returns:
- Iterator of names or null if no parameters are set.
Gets the names of the parameters.
getCacheTime
public long getCacheTime()
- Returns:
- Cache time in milliseconds
Gets length of cache expiration 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
.
setCacheTime
public void setCacheTime(long cacheTime)
- Parameters:
cacheTime
- the cache time in milliseconds.
Sets length of cache expiration 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.
getBufferSize
public int getBufferSize()
- Returns:
- int The size of the buffer in bytes.
Gets the size of the download buffer.
setBufferSize
public void setBufferSize(int bufferSize)
- Parameters:
bufferSize
- the size of the buffer in bytes.
Sets the size of the download buffer.