Class FileResource

File resources are files or directories on local filesystem. The files and directories are served trough URI:s to the client terminal and thus must be registered to an URI context before they can be used. The resource is automatically registered to the application when it is created.

Synopsis

Since

3.0

Inheritance Path.  java.lang.Object-> com.itmill.toolkit.terminal.FileResource

FileResource(File, Application)

Create new file resource for providing given file for client terminals.

getApplication()

Description copied from interface: getApplication

Get the application of the resource

getBufferSize()

Parameters

return

int The size of the buffer in bytes.

Description copied from interface: getBufferSize

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.

getCacheTime()

Parameters

return

Cache time in milliseconds

Get lenght 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 DownloadStream.DEFAULT_CACHETIME.

getFilename()

See Also
getFilename()
Description copied from interface: getFilename

Get virtual filename for the resource

getMIMEType()

See Also
getMIMEType()

getSourceFile()

Parameters

return

File

Returns the source file.

getStream()

Description copied from interface: getStream

Get resource as stream

setBufferSize(int)

Parameters

bufferSize

The size of the buffer in bytes.

Set the size of the download buffer used for this resource.

setCacheTime(long)

Parameters

cacheTime

The cache time in milliseconds.

Set lenght 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.

setSourceFile(File)

Parameters

sourceFile

The source file to set

Sets the source file.