Class ByteDoc
java.lang.Object
ch.software_atelier.simpleflex.docs.WebDoc
ch.software_atelier.simpleflex.docs.impl.ByteDoc
This is a simple WebDoc-Class for sending a byte-Array.
It is a document-container-class that holds your generated data.
-
Nested Class Summary
Nested classes/interfaces inherited from class ch.software_atelier.simpleflex.docs.WebDoc
WebDoc.HTTPCode -
Field Summary
Fields inherited from class ch.software_atelier.simpleflex.docs.WebDoc
DATA_BYTE, DATA_STREAM -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]byteData()If you want to return the documents data as a byte[], you have to do that here.voidclose()This method is called after the transmission.dataType()Specifies the Type of served data.mime()This method has to return the MIME-Type of the Document.name()This method has to return the FileName of the Document.longsize()This method has to return the size of the Document in bytes.If you want to return the documents data as a Stream, you have to do that here.Methods inherited from class ch.software_atelier.simpleflex.docs.WebDoc
getHeaders, getHttpCode, setHTTPCode
-
Constructor Details
-
ByteDoc
- Parameters:
data- The data, that must be sentname- The Name of the filemime- The mimeType of the File
-
-
Method Details
-
size
public long size()Description copied from class:WebDocThis method has to return the size of the Document in bytes. -
mime
Description copied from class:WebDocThis method has to return the MIME-Type of the Document. Example: text/plain. You can also use the static Method Utils.getMime(String ext) to get the MIME-Type of a File-Extension. -
name
Description copied from class:WebDocThis method has to return the FileName of the Document. -
byteData
public byte[] byteData()Description copied from class:WebDocIf you want to return the documents data as a byte[], you have to do that here. Be sure, that the method dataType() returns WebDoc.DATA_BYTE! Else just return null or something else. If the method dataType() does not return WebDoc.DATA_BYTE, this method will never be called. -
streamData
Description copied from class:WebDocIf you want to return the documents data as a Stream, you have to do that here. Be sure, that the method dataType() returns WebDoc.DATA_STREAM! Else just return null or something else. If the method dataType() does not return WebDoc.DATA_STREAM, this method will never be called. The Stream will be closed by the Server-App so you have nothing to do with that.- Specified by:
streamDatain classWebDoc- Returns:
-
dataType
Description copied from class:WebDocSpecifies the Type of served data. Look at streamData() and/or byteData() -
close
public void close()Description copied from class:WebDocThis method is called after the transmission. It can be used to cleanup something.
-