oracle.forms.demos.uploadserver
Class FormsDecoder

java.lang.Object
  |
  +--oracle.forms.demos.uploadserver.FormsDecoder

public class FormsDecoder
extends java.lang.Object

This class performs the task of assisting with the conversion of BASE64 encoded data and the subsequent storage in a file. This class was designed primarily for use from the Forms 6i Java Importer in conjunction with the FileUploader JavaBean.

The FileUploader JavaBean returns BASE64 encoded data in a series of 4K chunks which need to be reassembled into a contiguous string for use in the decoding process. This class enables a Form to store the chunks of data it receives with the addChunk() method and then to decode the chunks using the decodeBuffer() method.

The Byte stream of the uploaded file may have been compressed before uploading so the decodeBuffer() method takes care of that as well

Version:
1.1
Author:
Steve Button, Duncan Mills

Constructor Summary
FormsDecoder()
          Create a new FormsDecoder object.
 
Method Summary
 void addChunk(java.lang.String data)
          Appends a chunk of data to the end of the buffer.
 void decodeBuffer(java.lang.String directoryName, java.lang.String fileName, int filesize, boolean isCompressed)
          Convert the data that has been added to the buffer via the addChunk method to it's original format using sun.misc.BASE64Decoder and write it out to the specified filename.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FormsDecoder

public FormsDecoder()
Create a new FormsDecoder object. This operation initialises the buffer used to store the fragments.
Method Detail

addChunk

public void addChunk(java.lang.String data)
Appends a chunk of data to the end of the buffer.
Parameters:
data - the chunk of data to be appended to the buffer.

decodeBuffer

public void decodeBuffer(java.lang.String directoryName,
                         java.lang.String fileName,
                         int filesize,
                         boolean isCompressed)
                  throws java.io.IOException,
                         FormsDecoderException
Convert the data that has been added to the buffer via the addChunk method to it's original format using sun.misc.BASE64Decoder and write it out to the specified filename.
Parameters:
filename - the file to create for the decoded data.
filesize - the size of the uploaded file
isCompressed - indicator that we need to unzip the file
Throws:
java.io.IOException -  
FormsDecoderException -