public class FileDownloadHelper
extends java.lang.Object
| Constructor and Description |
|---|
FileDownloadHelper() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
formatFileSize(long fileSize)
Format file size for displaying in bytes, KB, MB.
|
static java.lang.String |
formatFileSize(long longSize,
int decimalPos)
Format file size for displaying in bytes, KB, MB.
|
static void |
initGeneratedColumn(Table table)
Initializes a column for downloading files in a table displaying
FileDescriptors. |
static void |
initGeneratedColumn(Table table,
java.lang.String fileProperty)
Initializes a table column for downloading files.
|
static java.lang.String |
makeLink(FileDescriptor fd,
boolean newWindow,
boolean attachment)
Creates HTML link for downloading a file.
|
static java.lang.String |
makeUrl(FileDescriptor fd,
boolean attachment)
Creates URL for downloading a file.
|
public static java.lang.String makeLink(FileDescriptor fd, boolean newWindow, boolean attachment)
fd - file descriptornewWindow - adds target="_blank"attachment - sets Content-Disposition: attachmentpublic static java.lang.String makeUrl(FileDescriptor fd, boolean attachment)
fd - file descriptorattachment - sets Content-Disposition: attachmentpublic static void initGeneratedColumn(Table table)
FileDescriptors.table - table that displays instances of the FileDescriptor entitypublic static void initGeneratedColumn(Table table, java.lang.String fileProperty)
table - table displaying some entityfileProperty - property of the entity which is a reference to FileDescriptorpublic static java.lang.String formatFileSize(long longSize,
int decimalPos)
longSize - size in bytesdecimalPos - maximum fraction digitspublic static java.lang.String formatFileSize(long fileSize)
fileSize - size in bytes