Examples of BASE64Encoder


Examples of com.oreilly.servlet.Base64Encoder

    out.append("Content-Disposition: attachment;").append(CRLF);
    out.append(" filename=\"").append(sStrippedFileName).append("\"").append(CRLF);

    out.append(CRLF);
   
    Base64Encoder encoder = null;

    try {
      final ByteArrayOutputStream baos = new ByteArrayOutputStream();
     
      encoder = new Base64Encoder(baos);

      final byte[] buf = new byte[4 * 1024]; // 4K buffer
      int bytesRead;

      while ((bytesRead = in.read(buf)) != -1) {
        encoder.write(buf, 0, bytesRead);
      }
     
      encoder.flush();
     
      out.append(baos.toString("US-ASCII"));
    }
    catch (Throwable e) {
      Log.log(Log.FATAL, "lazyj.mail.Sendmail", "writeAttachment" + e);
      this.iSentOk = SENT_ERROR;
      this.sError = "exception while writing an attachment : " + e.getMessage();
      return false;
    }
    finally{
      if (in != null)
        try{
          in.close();
        }
        catch (IOException e){
          // ignore
        }
     
      if (encoder != null){
        try{
          encoder.close();
        }
        catch (IOException e){
          // ignore
        }
      }
View Full Code Here

Examples of com.sun.jini.jeri.internal.runtime.BASE64Encoder

      authUser = user;
      authPassword = new String(password);
  }
 
  if (authScheme.equals("Basic")) {
      BASE64Encoder enc = new BASE64Encoder();
      return "Basic " +
    enc.encode((authUser + ":" + authPassword).getBytes());
  } else if (authScheme.equals("Digest")) {
      String digest;
      try {
    digest = computeDigest(method, uri);
      } catch (NoSuchAlgorithmException ex) {
View Full Code Here

Examples of com.sun.messaging.jmq.util.BASE64Encoder

        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        DataOutputStream dos = new DataOutputStream(bos);

        dos.writeUTF(username);

        BASE64Encoder encoder = new BASE64Encoder();
        String encodepass = encoder.encode(password.getBytes("UTF8"));
        dos.writeUTF(encodepass);
        dos.flush();
        response = bos.toByteArray();
        dos.close();
        return response;
View Full Code Here

Examples of com.sun.messaging.jmq.util.BASE64Encoder

        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        DataOutputStream dos = new DataOutputStream(bos);

        dos.writeUTF(username);

        BASE64Encoder encoder = new BASE64Encoder();
        String encodepass = encoder.encode(password.getBytes("UTF8"));
        dos.writeUTF(encodepass);
        dos.flush();
        response = bos.toByteArray();
        dos.close();
        return response;
View Full Code Here

Examples of com.thoughtworks.xstream.core.util.Base64Encoder

  public String toString(Object obj) {
    try {
      File file = ((Blob) obj).getFile();
      if (file.exists()) {
        return new Base64Encoder().encode(FileUtils
            .readFileToByteArray(file));
      } else {
        return "";
      }
    } catch (Exception e) {
View Full Code Here

Examples of com.thoughtworks.xstream.core.util.Base64Encoder

  public Object fromString(String str) {
    Blob blob = new Blob();
    try {
      FileUtils.writeByteArrayToFile(blob.getFile(),
          new Base64Encoder().decode(str));
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
    return blob;
  }
View Full Code Here

Examples of com.thoughtworks.xstream.core.util.Base64Encoder

        String home = getHudsonHome();
        if(!home.endsWith("/"))     home = home + '/'// make sure it ends with '/'

        // check for authentication info
        String auth = new URL(home).getUserInfo();
        if(auth != null) auth = "Basic " + new Base64Encoder().encode(auth.getBytes("UTF-8"));

        {// check if the home is set correctly
            HttpURLConnection con = open(new URL(home));
            if (auth != null) con.setRequestProperty("Authorization", auth);
            con.connect();
View Full Code Here

Examples of com.zaranux.client.crypto.BASE64Encoder

     
    if(data != null && "write".equals(systemcall))  // binary data needs to be converted to BASE64 format
    {
      try
      {
        BASE64Data = new BASE64Encoder().encode(data, offset, len);
        Log.debug("BASE64Data: " +BASE64Data);
      }catch (Throwable e)
      {
        Log.debug("Proxy BASE64Encoder().encode" + e);
      }
View Full Code Here

Examples of org.apache.batik.util.Base64Encoder

        byte[] pngBytes = encodeImage(image);

        //
        // Now, convert PNG data to Base64
        //
        Base64Encoder b64Encoder = new Base64Encoder();
        ByteArrayInputStream is = new ByteArrayInputStream(pngBytes);
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        try {
            b64Encoder.encodeBuffer(new ByteArrayInputStream(pngBytes),
                                    os);
        } catch (IOException e) {
            // Should not happen because we are doing in-memory processing
            throw new SVGGraphics2DIOException(ERR_UNEXPECTED, e);
        }
View Full Code Here

Examples of org.apache.geronimo.mail.util.Base64Encoder

            // of a 75 character size limit and all of the encoding overhead elements.
            int sizeLimit = 75 - 7 - charset.length();
           
            // now do the appropriate encoding work
            if (encoder.equals("base64")) {
                Base64Encoder dataEncoder = new Base64Encoder();
                // this may recurse on the encoding if the string is too long.  The left-most will not
                // get a segment delimiter
                encodeBase64(word, result, sizeLimit, charset, dataEncoder, true, SessionUtil.getBooleanProperty(MIME_FOLDENCODEDWORDS, false));
            }
            else {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.