com.efaxdeveloper.util.outbound
Class DocumentBundler

java.lang.Object
  extended by com.efaxdeveloper.util.outbound.DocumentBundler

public class DocumentBundler
extends java.lang.Object

DocumentBundler

Overview

The DocumentBundler is used by the client-side process to bundle all documents for transmission. The programmer will instantiate a DocumentBundler and add each document to the bundle via the object's mutator methods.

The following snippet provides an example of how the DocumentBundler might be used within the client-side process:

   // Instantiate a new OutboundRequest object
   OutboundRequest req = new OutboundRequest();

   ...

   // Instantiate a DocumentBundler object
   DocumentBundler docs = new DocumentBundler();

   // Add document(s) to the DocumentBundler object by path (most common method)
   docs.add("C:\\your\\document\\path\\your.doc");
   // Add a document as a string if you desire to the DocumentBundler object
   docs.add("This string will be faxed as a separate document", ".txt");
   // Add binary large object (BLOB) data as a byte array if desired
   docs.add(someByteArray[], ".xls");

   // Set the documents to be faxed to the OutboundRequest instance
   req.setDocuments(docs);
   
 

Since:
1.0
Version:
2.0
See Also:
OutboundRequest, OutboundRequest.setDocuments(DocumentBundler)

Constructor Summary
DocumentBundler()
          Constructor method for DocumentBundler
 
Method Summary
 void add(byte[] bytes, java.lang.String fileType)
          Method used to Base64 encode and store binary document (BLOB) contents passed as a byte array.
 void add(java.lang.String documentPath)
          Method used to Base64 encode and store a document file for transmission.
 void add(java.lang.String contentString, java.lang.String fileType)
          Method used to Base64 encode and store document contents passed as a string.
 java.util.ArrayList<Base64Doc> get()
          Method used to retrieve an ArrayList object of documents stored for transmission
 int size()
          Method used to return the number of documents stored for transmission
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocumentBundler

public DocumentBundler()
Constructor method for DocumentBundler

Method Detail

add

public void add(byte[] bytes,
                java.lang.String fileType)
         throws java.io.IOException
Method used to Base64 encode and store binary document (BLOB) contents passed as a byte array.

A Binary Large Object or BLOB is a collection of binary data stored as part of a database record.

Parameters:
bytes - the byte representation of the binary document contents to be encoded and stored
fileType - the file extension of the file to be encoded
Throws:
java.io.IOException
See Also:
add(String), add(String, String)

add

public void add(java.lang.String documentPath)
         throws java.io.IOException
Method used to Base64 encode and store a document file for transmission.

Parameters:
documentPath - the physical path to the document file to be encoded and stored
Throws:
java.io.IOException
See Also:
add(byte[], String), add(String, String)

add

public void add(java.lang.String contentString,
                java.lang.String fileType)
         throws java.io.IOException
Method used to Base64 encode and store document contents passed as a string.

Pre-Base64 encoded contentString arguments can be passed and will be added as entered.

Parameters:
contentString - the string representation of the document contents to be encoded and stored
fileType - the file extension of the file to be encoded
Throws:
java.io.IOException
See Also:
add(String), add(byte[], String)

get

public java.util.ArrayList<Base64Doc> get()
Method used to retrieve an ArrayList object of documents stored for transmission

Returns:
an ArrayList object containing the Base64 encoded documents stored for transmission

size

public int size()
Method used to return the number of documents stored for transmission

Returns:
an Integer value denoting the number of documents stored for transmission