Package org.exist.util

Examples of org.exist.util.Base64Encoder.translate()


      return toDateTime((Date) o).toString();
    } else if (o instanceof Calendar) {
      return toDateTime(((Calendar) o).getTimeInMillis()).toString();
    } else if (o instanceof byte[]) {
      Base64Encoder encoder = new Base64Encoder();
      encoder.translate((byte[]) o);
      return String.valueOf(encoder.getCharArray());
    } else {
      return o;
    }
  }
View Full Code Here


     * @return    The encoded String
     */
    private String encode64 (String str) throws java.io.UnsupportedEncodingException
    {
        Base64Encoder enc = new Base64Encoder();
        enc.translate(str.getBytes(charset));
        String result = new String(enc.getCharArray());

        result = result.replaceAll("\n","?=\n =?" + charset + "?B?");
        result = "=?" + charset + "?B?" + result + "?=";
        return(result);
View Full Code Here

    private String generateSeriesToken() {
        byte[] newSeries = new byte[DEFAULT_SERIES_LENGTH];
        random.nextBytes(newSeries);

        Base64Encoder encoder = new Base64Encoder();
        encoder.translate(newSeries);
        return new String(encoder.getCharArray());
    }

    private String generateToken() {
        byte[] newSeries = new byte[DEFAULT_TOKEN_LENGTH];
View Full Code Here

    private String generateToken() {
        byte[] newSeries = new byte[DEFAULT_TOKEN_LENGTH];
        random.nextBytes(newSeries);

        Base64Encoder encoder = new Base64Encoder();
        encoder.translate(newSeries);
        return new String(encoder.getCharArray());
    }

    public class LoginDetails {
View Full Code Here

   
   
    @BeforeClass
    public final static void createCredentials() {
        Base64Encoder enc = new Base64Encoder();
        enc.translate("admin:".getBytes());
        credentials = new String(enc.getCharArray());

        enc.reset();
        enc.translate("johndoe:this pw should fail".getBytes());
        badCredentials = new String(enc.getCharArray());
View Full Code Here

        Base64Encoder enc = new Base64Encoder();
        enc.translate("admin:".getBytes());
        credentials = new String(enc.getCharArray());

        enc.reset();
        enc.translate("johndoe:this pw should fail".getBytes());
        badCredentials = new String(enc.getCharArray());
    }

    @Before
    public void setUp() throws Exception {
View Full Code Here

            final byte[] digestData = md5.digest();
           
            if(base64)
            {
              final Base64Encoder enc = new Base64Encoder();
              enc.translate(digestData);
              digest = new String(enc.getCharArray());
            }
            else
            {
               digest = byteArrayToHex( digestData );
View Full Code Here

        // Write digest as string
        String digest = null;
        if(base64)
        {
            final Base64Encoder enc = new Base64Encoder();
            enc.translate(digestData);
            digest = new String(enc.getCharArray());

        } else {
           digest = byteArrayToHex( digestData );
        }
View Full Code Here

      }
 
          if( isCalledAs( "base64-encode" ) ) {
               final Base64Encoder enc = new Base64Encoder();
         
            enc.translate( str.getBytes()  );
       
        if( trim ) {
              value = new StringValue( new String( enc.getCharArray() ).trim() );
        } else {
          value = new StringValue( new String( enc.getCharArray() ) );
View Full Code Here

                        "transaction_id=\""+transactionID+"\"><![CDATA[";
            String tail =
              "]]></response>";

            Base64Encoder enc = new Base64Encoder();
            enc.translate(source);

            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            baos.write(head.getBytes());
            baos.write(new String(enc.getCharArray()).getBytes());
            baos.write(tail.getBytes());
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.