return encodeBytes( source, 0, source.length, options );
/** * Encodes a byte array into Base64 notation. * Does not GZip-compress data. * * @param source The data to convert * @return The data in Base64-encoded form * @throws NullPointerException if source array is null * @since 1.4 */ public static String encodeBytes( byte[] source ) { // Since we're not going to have the GZIP encoding turned on, // we're not going to have an java.io.IOException thrown, so // we should not force the user to have to catch it. String encoded = null; try { encoded = encodeBytes(source, 0, source.length, NO_OPTIONS); } catch (java.io.IOException ex) { assert false : ex.getMessage(); } // end catch assert encoded != null; return encoded; } // end encodeBytes
encoded = encodeBytes( source, off, len, NO_OPTIONS ); } catch (java.io.IOException ex) { assert false : ex.getMessage();
private String hashHost(String host) throws IOException { sha1.init(getSaltyBytes()); return "|1|" + salt + "|" + Base64.encodeBytes(sha1.doFinal(host.getBytes(IOUtils.UTF8))); }
private String getKeyString(PublicKey pk) { final Buffer.PlainBuffer buf = new Buffer.PlainBuffer().putPublicKey(pk); return Base64.encodeBytes(buf.array(), buf.rpos(), buf.available()); }
return encodeBytes( source, 0, source.length, options );
/** * Encodes a byte array into Base64 notation. <p> Example options: <p/> * <pre> * GZIP: gzip-compresses object before encoding it. * DO_BREAK_LINES: break lines at 76 characters * <i>Note: Technically, this makes your encoding non-compliant.</i> * </pre> * <p> Example: <code>encodeBytes( myData, Base64.GZIP )</code> or <p> Example: <code>encodeBytes( myData, * Base64.GZIP | Base64.DO_BREAK_LINES )</code> <p/> <p/> <p> As of v 2.3, if there is an error with the GZIP * stream, the method will throw an java.io.IOException. <b>This is new to v2.3!</b> In earlier versions, it just * returned a null value, but in retrospect that's a pretty poor way to next it. </p> * * @param source The data to convert * @param options Specified options * * @return The Base64-encoded data as a String * * @throws java.io.IOException if there is an error * @throws NullPointerException if source array is null * @see Base64#GZIP * @see Base64#DO_BREAK_LINES * @since 2.0 */ public static String encodeBytes(byte[] source, int options) throws java.io.IOException { return encodeBytes(source, 0, source.length, options); } // end encodeBytes
/** * Encodes a byte array into Base64 notation. * Does not GZip-compress data. * * @param source The data to convert * @return The data in Base64-encoded form * @throws NullPointerException if source array is null * @since 1.4 */ public static String encodeBytes( byte[] source ) { // Since we're not going to have the GZIP encoding turned on, // we're not going to have an java.io.IOException thrown, so // we should not force the user to have to catch it. String encoded = null; try { encoded = encodeBytes(source, 0, source.length, NO_OPTIONS); } catch (java.io.IOException ex) { assert false : ex.getMessage(); } // end catch assert encoded != null; return encoded; } // end encodeBytes
/** * Encodes a byte array into Base64 notation. Does not GZip-compress data. * * @param source The data to convert * * @return The data in Base64-encoded form * * @throws NullPointerException if source array is null * @since 1.4 */ public static String encodeBytes(byte[] source) { // Since we're not going to have the GZIP encoding turned on, // we're not going to have an java.io.IOException thrown, so // we should not force the user to have to catch it. String encoded = null; try { encoded = encodeBytes(source, 0, source.length, NO_OPTIONS); } catch (java.io.IOException ex) { assert false : ex.getMessage(); } // end catch assert encoded != null; return encoded; } // end encodeBytes
/** * Encodes a byte array into Base64 notation. Does not GZip-compress data. <p/> <p> As of v 2.3, if there is an * error, the method will throw an java.io.IOException. <b>This is new to v2.3!</b> In earlier versions, it just * returned a null value, but in retrospect that's a pretty poor way to next it. </p> * * @param source The data to convert * @param off Offset in array where conversion should begin * @param len Length of data to convert * * @return The Base64-encoded data as a String * * @throws NullPointerException if source array is null * @throws IllegalArgumentException if source array, offset, or length are invalid * @since 1.4 */ public static String encodeBytes(byte[] source, int off, int len) { // Since we're not going to have the GZIP encoding turned on, // we're not going to have an java.io.IOException thrown, so // we should not force the user to have to catch it. String encoded = null; try { encoded = encodeBytes(source, off, len, NO_OPTIONS); } catch (java.io.IOException ex) { assert false : ex.getMessage(); } // end catch assert encoded != null; return encoded; } // end encodeBytes
encoded = encodeBytes( source, off, len, NO_OPTIONS ); } catch (java.io.IOException ex) { assert false : ex.getMessage();
private String hashHost(String host) throws IOException { sha1.init(getSaltyBytes()); return "|1|" + salt + "|" + Base64.encodeBytes(sha1.doFinal(host.getBytes(IOUtils.UTF8))); }
private String hashHost(String host) throws IOException { sha1.init(getSaltyBytes()); return "|1|" + salt + "|" + Base64.encodeBytes(sha1.doFinal(host.getBytes(IOUtils.UTF8))); }
private String getKeyString() { final Buffer.PlainBuffer buf = new Buffer.PlainBuffer().putPublicKey(key); return Base64.encodeBytes(buf.array(), buf.rpos(), buf.available()); }
private String getKeyString(PublicKey pk) { final Buffer.PlainBuffer buf = new Buffer.PlainBuffer().putPublicKey(pk); return Base64.encodeBytes(buf.array(), buf.rpos(), buf.available()); }