public class SimpleFileExportBean extends Object implements IFileExportBeanEx
Modifier and Type | Field and Description |
---|---|
protected byte[] |
binaryData
The data to be exported as
byte [] |
protected String |
charactersEncoding
Character encoding for export of file content.
|
protected int |
contentLength
The length of data.
|
protected String |
contentType
The content type, see
setExportContentType(String) . |
protected String |
fileName
Name of the file to be exported.
|
protected boolean |
forceDownload
boolean for force download, see
setDownloadForced(boolean) . |
protected boolean |
isBinary
boolean that denotes that the content is binary. |
protected String |
textData
The data to be exported as
String |
UNKNOWN_CONTENT_LENGTH
Constructor and Description |
---|
SimpleFileExportBean()
Bean empty constructor
|
SimpleFileExportBean(String fileName,
String contentType,
int contentLength,
boolean forceDownload,
byte[] binaryData)
Constructor.
|
SimpleFileExportBean(String fileName,
String contentType,
int contentLength,
boolean forceDownload,
String textData)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
getBinaryData()
Returns the binary data.
|
String |
getExportCharacterEncoding()
Returns character encoding for this export file content (valid only when isExportBinary() == false)
|
int |
getExportContentLength()
Return the length of the content that is to be exported.
|
String |
getExportContentType()
Gets the content type of the response being sent to the client.
|
String |
getExportFileName()
Return the file name for the exported data
|
String |
getTextData()
Returns the text data.
|
boolean |
isDownloadForced()
Return true to send the response headers that will force the user
to choose what to do with the file (Open vs.
|
boolean |
isExportBinary()
Return true if the export will be sending binary data to the response, false if
the export will be sending text.
|
void |
setBinaryData(byte[] binaryData)
Sets the binary data for export.
|
void |
setDownloadForced(boolean forceDownload)
Sets force download to send the response headers that will force the user
to choose what to do with the file (Open vs.
|
void |
setExportCharacterEncoding(String encoding)
Sets character encoding for this export file content (valid only when
isExportBinary() == false)
|
void |
setExportContentType(String contentType)
Sets the content type of the response being sent to the client.
|
void |
setExportFileName(String fileName)
Return the file name for the exported data.
|
void |
setTextData(String textData)
Sets the text data for export.
|
void |
writeExportBytes(OutputStream outStream)
Invoked to allow the bean to write binary data to
the output stream.
|
void |
writeExportText(PrintWriter writer)
Invoked to allow the bean to write the export text
to the output writer.
|
protected boolean forceDownload
boolean
for force download, see
setDownloadForced(boolean)
.protected String fileName
protected String contentType
setExportContentType(String)
.protected int contentLength
protected boolean isBinary
boolean
that denotes that the content is binary.protected byte[] binaryData
byte []
protected String textData
String
protected String charactersEncoding
Default: UTF-8
public SimpleFileExportBean()
public SimpleFileExportBean(String fileName, String contentType, int contentLength, boolean forceDownload, byte[] binaryData)
fileName
- name of the file to be exportedcontentType
- the content type, see setExportContentType(String)
contentLength
- the length of dataforceDownload
- force download, see setDownloadForced(boolean)
binaryData
- the data to be exported as byte []
public SimpleFileExportBean(String fileName, String contentType, int contentLength, boolean forceDownload, String textData)
fileName
- name of the file to be exportedcontentType
- the content type, see setExportContentType(String)
contentLength
- the length of dataforceDownload
- force download, see setDownloadForced(boolean)
textData
- the data to be exported as String
public boolean isDownloadForced()
IFileExportBean
isDownloadForced
in interface IFileExportBean
public void setDownloadForced(boolean forceDownload)
forceDownload
- The forceDownload to set.public String getExportFileName()
IFileExportBean
getExportFileName
in interface IFileExportBean
public void setExportFileName(String fileName)
fileName
- name for the filepublic String getExportContentType()
IFileExportBean
getExportContentType
in interface IFileExportBean
public void setExportContentType(String contentType)
The content type may include the type of character encoding used, for example, text/html; charset=ISO-8859-4.
contentType
- public int getExportContentLength()
IFileExportBean
getExportContentLength
in interface IFileExportBean
IFileExportBean.UNKNOWN_CONTENT_LENGTH
if it is not knownpublic boolean isExportBinary()
IFileExportBean
isExportBinary
in interface IFileExportBean
public void writeExportText(PrintWriter writer)
IFileExportBean
writeExportText
in interface IFileExportBean
writer
- the output writerpublic void writeExportBytes(OutputStream outStream) throws IOException
IFileExportBean
writeExportBytes
in interface IFileExportBean
outStream
- the output streamIOException
- thrown if there is an I/O exception during the exportpublic String getExportCharacterEncoding()
IFileExportBeanEx
getExportCharacterEncoding
in interface IFileExportBeanEx
public void setExportCharacterEncoding(String encoding)
encoding
- Java character encoding namepublic byte[] getBinaryData()
public void setBinaryData(byte[] binaryData)
binaryData
- binary data as byte []
public String getTextData()
public void setTextData(String textData)
textData
- text data as String