Oracle Forms 9i Samples and Demos


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

Change History

drmills 23-Oct-2001 - Code added to allow unicode filenames. Better error handling

Version:
9.0.1
Author:
Steve Button, Duncan Mills, JongHyuk Song

Field Summary
static java.lang.String FormsDecoderVersion
           
 
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.
 void setLogFileName(java.lang.String logFile)
          Define a debugging log file - setting this with the name of an o/s file implicitly switches debugging on
 void throwEx()
          Test - Throws a FormsDecoder exception
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FormsDecoderVersion

public static java.lang.String FormsDecoderVersion
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)
              throws FormsDecoderException
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 ilef
isCompressed - indicator that we need to unzip the file
Throws:
java.io.IOException -  
FormsDecoderException -  

setLogFileName

public void setLogFileName(java.lang.String logFile)
Define a debugging log file - setting this with the name of an o/s file implicitly switches debugging on

throwEx

public void throwEx()
             throws FormsDecoderException
Test - Throws a FormsDecoder exception

Oracle Forms 9i Samples and Demos