/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package jxfdl;

import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.zip.GZIPInputStream;
import jxfdl.utils.Base64GZip;
import sun.misc.BASE64Decoder;

/**
 *
 * @author unamanic
 */
public class XFDLForm {

  private String formXMLString;
  private String header  = "";

  public XFDLForm(File fileIn) {
    try {

      FileInputStream fis = new FileInputStream(fileIn);
      
      StringBuffer formXML = new StringBuffer();

      //purge header info
      for (int i = 0; i < 52; i++) {
        header += (char)fis.read();
      }
      
      InputStream processed = Base64GZip.B64GzipToInputStream(fis);

      int c = 0;
      while ((c = processed.read()) != -1) {
        formXML.append((char) c);
      }
      
      formXMLString = formXML.toString();

      fis.close();

    } catch (Exception e) {
      e.printStackTrace();
    }
  }

  public String getFormXMLString() {
    return formXMLString;
  }

  public String getHeader() {
    return header;
  }
  
  
}

@@ -113,45 +113,8 @@
 l;%0A%0A
-import java.io.ByteArrayInputStream;%0A
 impo
@@ -202,98 +202,29 @@
 rt j
-ava.util.zip.GZIPInputStream;%0Aimport jxfdl.utils.Base64GZip;%0Aimport sun.misc.BASE64Decoder
+xfdl.utils.Base64GZip
 ;%0A%0A/
@@ -464,18 +464,19 @@
 StringBu
-ff
+ild
 er formX
@@ -496,10 +496,11 @@
 ngBu
-ff
+ild
 er()
@@ -696,20 +696,16 @@
    int c
- = 0
 ;%0A      

Switch to StringBuilder