title: uuencode zipfile in java
body: <p>I am a novice user trying to figure out how to use uuencode method. We have a form that allows only a single text file to be uploaded. Now it looks like only zip files will be uploaded. I am trying to include uuencode method to convert bytes to String so that we dont have to modify the rest of the code to accommodate the binary file. </p>
  
  <p>Original code: </p>
  
  <pre><code>public void SettingUpload(File inputfile) { 
      this.inputfile = inputfile;
  }
  </code></pre>
  
  <p>I changed it to</p>
  
  <pre><code>public void SettingUpload(File inputfile){
  UUEncoder uuec = new UUEncoder();
      try{
          InputStream is = new FileInputStream(inputfile);
          OutputStream os = new FileOutputStream(inputfile);
          uuec.encodeBuffer(is, os);
          this.inputfile = inputfile;
      }catch (Throwable error) {
          reportError(error, "Error converting zipfile");
      }
  
  }
  </code></pre>
  
  <p>When I tested it out, I got a java.io.EOFException. I grabbed the uuencoded file and manually uudecoded it. When I tried to unzip it, </p>
  
  <pre><code>bash1:~&gt;unzip s6b0c9e663c74f72941bd8271a5fac3b.bin 
   Archive:  s6b0c9e663c74f72941bd8271a5fac3b.bin
  
   End-of-central-directory signature not found.  Either this file is not
   a zipfile, or it constitutes one disk of a multi-part archive.  In the
  </code></pre>
  
  <p>Edit: </p>
  
  <p>I changed it to:</p>
  
  <pre><code> public void SettingUpload(File inputfile){
      UUEncoder uuec = new UUEncoder();
          try{
              InputStream is = new FileInputStream(inputfile);
                     File OutputFile=new File("Output");
                          OutputFile.createNewFile();
              OutputStream os = new FileOutputStream(OutputFile);
              uuec.encodeBuffer(is, os);
              this.OutputFile = OutputFile;
          }catch (Throwable error) {
              reportError(error, "Error converting zipfile");
          }
  
   }
  </code></pre>
  
  <p>and I get the following error:</p>
  
  <pre><code>cannot find symbol
  symbol  : variable OutputFile
  </code></pre>