|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ByteArrayEncoder
This interface contains all technical methods to encode data, into a given
character encoding. This is especially useful to encode the HTTP output to
the server.
Each appendXxxx method returns the current instance. This allows easy
concatanation of calls to this class. For instance:
bae.append(a).appendFileProperty(b, c).append(d);
FileUploadThreadHTTP
Method Summary | |
---|---|
ByteArrayEncoder |
append(byte[] b)
Append a stream, to be encoded at the current end of the byte array. |
ByteArrayEncoder |
append(ByteArrayEncoder bae)
Append a string, to be encoded at the current end of the byte array. |
ByteArrayEncoder |
append(int b)
Append a byte, to be encoded at the current end of the byte array. he byte to be written is the eight low-order bits of the argument b. |
ByteArrayEncoder |
append(java.lang.String str)
Append a string, to be encoded at the current end of the byte array. |
ByteArrayEncoder |
appendEndPropertyList()
Finish a property list. |
ByteArrayEncoder |
appendFormVariables(java.lang.String formname)
Add to the current encoder all properties contained in the given HTML form. |
ByteArrayEncoder |
appendTextProperty(java.lang.String name,
java.lang.String value,
int index)
Append a property, name and value. |
void |
close()
Closes the encoding writer, and prepares the encoded length and byte array. |
java.lang.String |
getBoundary()
Gets the HTTP boundary, that separate the form variables. |
byte[] |
getEncodedByteArray()
Get the encoded result. |
int |
getEncodedLength()
Get the length of the encoded result. |
java.lang.String |
getEncoding()
|
java.lang.String |
getString()
Get the String that matches the encoded result. |
boolean |
isClosed()
|
Method Detail |
---|
void close() throws JUploadIOException
getEncodedLength()
and getEncodedByteArray()
.
Note: After a call to this method, you can not append any new data
to the encoder.
JUploadIOException
- Encapsulates any IO ExceptionByteArrayEncoder append(java.lang.String str) throws JUploadIOException
str
- The string to append and encode.
JUploadIOException
ByteArrayEncoder append(int b) throws JUploadIOException
b
- Writes the specified byte to this output stream.
JUploadIOException
ByteArrayEncoder append(byte[] b) throws JUploadIOException
b
-
JUploadIOException
ByteArrayEncoder appendTextProperty(java.lang.String name, java.lang.String value, int index) throws JUploadIOException
appendEndPropertyList()
, to properly finish the property list.
In HTTP mode, it will add the last boundary, at a specific format.
name
- Name of the property to be addedvalue
- Value of this property for the current file. It's up to the
caller to call this method at the right time.index
- Index of the file concerned by this value. -1 if this is a
global parameter.
JUploadIOException
appendEndPropertyList()
ByteArrayEncoder appendEndPropertyList() throws JUploadIOException
JUploadIOException
ByteArrayEncoder appendFormVariables(java.lang.String formname) throws JUploadIOException
appendTextProperty(String, String, int)
.
formname
- The HTML form name. This method will get the data from
this form, by using the JUploadContext.getApplet()
method.
JUploadIOException
ByteArrayEncoder append(ByteArrayEncoder bae) throws JUploadIOException
bae
- The ByteArrayEncoder whose encoding result should be appended
to the current encoder. bae must be closed, before being
appended.
JUploadIOException
- This exception is thrown when this method is
called on a non-closed encoder.boolean isClosed()
java.lang.String getBoundary()
java.lang.String getEncoding()
int getEncodedLength() throws JUploadIOException
JUploadIOException
- This exception is thrown when this method is
called on a non-closed encoder.byte[] getEncodedByteArray() throws JUploadIOException
JUploadIOException
- This exception is thrown when this method is
called on a non-closed encoder.java.lang.String getString() throws JUploadIOException
JUploadIOException
- This exception is thrown when this method is
called on a non-closed encoder.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |