Package org.apache.commons.codec.binary

Examples of org.apache.commons.codec.binary.Base64.decode()


    public static String unzipString(String s)
    {
        try
        {
          Base64 base64Codec = new Base64();
            ByteArrayInputStream decodedStream = new ByteArrayInputStream( base64Codec.decode( s.getBytes(ZIP_CHARSET) ) );
            InputStream unzippedStream = new GZIPInputStream(decodedStream);

            StringBuffer buf = new StringBuffer();
            int c;
            while ((c = unzippedStream.read()) != -1)
View Full Code Here


                Decoder dec = new Base64();
                String usernamePassword = "";

                try
                {
                    usernamePassword = new String( (byte[]) dec.decode( auth.substring( 6 ).getBytes() ) );
                }
                catch ( DecoderException ie )
                {
                    log.warn( "Error decoding username and password: {}", ie.getMessage() );
                }
View Full Code Here

        Base64 base64 = new Base64();
        byte[] byteData = null;

        try {
            byteData = base64.decode(string.getBytes());

        } catch (Throwable t) {
            String message =
                "error occured Base64 decoding: " + string + " : " + t;
            throw new IOException(message);
View Full Code Here

                Decoder dec = new Base64();
                String usernamePassword = "";

                try
                {
                    usernamePassword = new String( (byte[]) dec.decode( auth.substring( 6 ).getBytes() ) );
                }
                catch ( DecoderException ie )
                {
                    log.warn( "Error decoding username and password.", ie.getMessage() );
                }
View Full Code Here

        Base64 coder;
        key = new SecretKeySpec(secret.getBytes(), "AES");
        try {
            cipher = Cipher.getInstance("AES/ECB/PKCS5Padding", "SunJCE");
            coder = new Base64();
            byte[] encrypted = coder.decode(repoUserPassword.getBytes());
            cipher.init(Cipher.DECRYPT_MODE, key);
            byte[] decrypted = cipher.doFinal(encrypted);
            decryptPassword = new String(decrypted);
        } catch (Exception e) {
          log.error("Exception has occurred. " + e.getMessage());
View Full Code Here

    Base64 coder;
    key = new SecretKeySpec(secret.getBytes(), "AES");
    try {
      cipher = Cipher.getInstance("AES/ECB/PKCS5Padding", "SunJCE");
      coder = new Base64();
      byte[] encrypted = coder.decode(repoUserPassword.getBytes());
      cipher.init(Cipher.DECRYPT_MODE, key);
      byte[] decrypted = cipher.doFinal(encrypted);
      decryptPassword = new String(decrypted);
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

    }


    public void loadXmlFromBase64(String response) throws ParserConfigurationException, SAXException, IOException {
        Base64 base64 = new Base64();
        byte [] decodedB = base64.decode(response);
        String decodedS = new String(decodedB);
        loadXml(decodedS);
    }

    public boolean isValid() throws Exception {
View Full Code Here

      return base64encoder.encodeToString(s.getBytes()).trim();
  }
 
  public static String base64Decode(String n) {
      Base64 base64encoder=new Base64();
      byte[] bd=base64encoder.decode(n);
      String s=new String(bd);
    return s;
  }
 
  public static void dumpRequestVariables(String url, String authorisationHeader, FormParameters formParameters) {
View Full Code Here

        byte[] buffer = new byte[1024];
        int i;
        while ((i = stream.read(buffer)) != -1) {
            bo.write(buffer, 0, i);
        }
        return new ByteArrayInputStream(base64.decode(bo.toByteArray()));
    }

    private <T extends Element> Document<T> getEntry(InputStream stream,
            RequestContext request) throws ParseException, IOException {
        Parser parser = request.getAbdera().getParser();
View Full Code Here

  private Attachment getScreenshot() {
    final String base64Screenshot = getString(Commands.SCREENSHOT_COMMAND,
        new String[] {});
    final Base64 base64 = new Base64();
    final byte[] decodedScreenshot = base64.decode(base64Screenshot);
    final Attachment attachment = new BinaryAttachment(
        LinkLabels.SCREENSHOT, decodedScreenshot, FileExtensions.JPEG);
    return attachment;
  }
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.