title: compress base64 encoded string data into decode format
body: <p>Hi im decoding the base64 string data and saving into the database like url format with time stamp so i need to compress the decoded data and my compression like if the coming data is less than 100kb then no need to compress otherwise compress the data into 50% off.</p>
  
  <pre><code>try
  
  {
  
  String FileItemRefPath = propsFPCConfig.getProperty("fileCreationReferencePath");
  
  String imageURLReferncePath = propsFPCConfig.getProperty("imageURLReferncePath");
  
  File f = new File(FileItemRefPath+"/"+"productimages"+"/"+donorId);
  
  String strException = "Actual File "+f.getName();
  
  
  
          if(!f.exists())
  
          {
  
              if (!f.mkdirs())
  
              {
                  System.out.println("direction creation failed");
  
                  return null;
              }
          }
          else
          {
              boolean isdirCreationStatus = f.mkdirs();
          }   
  
  String strDateTobeAppended = new SimpleDateFormat("yyyyMMddhhmmss").format(new Date());
  
          String fileName = strImageName+strDateTobeAppended;
  
          savedFile = new File(f.getAbsolutePath()+"/"+fileName);
  
  
          strException=strException+" savedFile "+savedFile.getName();
  
          Base64 decoder = new Base64();
  
          byte[] decodedBytes = decoder.decode(strImageBase64);
  
          if( (decodedBytes != null) &amp;&amp; (decodedBytes.length != 0) )
          {
          System.out.println("Decoded bytes length:"+decodedBytes.length);
  
          fos = new FileOutputStream(savedFile);
  
          System.out.println(new String(decodedBytes) + "\n") ; 
  
          int x=0;
          {
              fos.write(decodedBytes, 0, decodedBytes.length);
          }
  
          fos.flush();
  
          }
  
          if(fos != null)
          {
              fos.close();
  
          System.out.println("file output stream"+savedFile.getName());
  
              return savedFile.getName();
          }
          else
          {
              return null;
          }
      }
      catch(Exception e)
      {
  
         e.printStackTrace();
      }
      finally
      {
         try 
         {
             if( fos!= null)
             {
                 fos.close();
             }
             else
             {
                 savedFile = null;
             }
         } 
         catch (IOException e) 
         {
  
          e.printStackTrace();
         }
      }
      return savedFile.getName();
  }
  </code></pre>