return encodeBytes(source, 0, source.length, options);
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
/** * 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
/** * Creates a basic authentication header value from a username and a * password. */ protected List<String> createBasicAuthHeaderValue(String username, String password) { if (password == null) { password = ""; } try { return Collections.singletonList("Basic " + Base64.encodeBytes((username + ":" + password).getBytes("ISO-8859-1"))); } catch (UnsupportedEncodingException e) { // shouldn't happen... return Collections.emptyList(); } }
/** * Generates a valid Atom id. */ public String generateAtomId(String input) { if (input == null) { return ID_DUMMY; } return ID_PREFIX + Base64.encodeBytes(IOUtils.toUTF8Bytes(input)); }
/** * Transforms the transaction into a cookie name. */ public String getCookieName(String token) { if (token == null || token.length() == 0) { return "cmis%"; } return "cmis_" + Base64.encodeBytes(IOUtils.toUTF8Bytes(token)).replace('=', '%'); }
encoded = encodeBytes(source, off, len, NO_OPTIONS); } catch (java.io.IOException ex) { assert false : ex.getMessage();
encoded = encodeBytes(source, off, len, NO_OPTIONS); } catch (java.io.IOException ex) { assert false : ex.getMessage();
/** * Creates a basic authentication header value from a username and a * password. */ protected List<String> createBasicAuthHeaderValue(String username, String password) { if (password == null) { password = ""; } Object charset = getSession().get(SessionParameter.AUTH_HTTP_BASIC_CHARSET); if (charset instanceof String) { charset = ((String) charset).trim(); } else { charset = IOUtils.UTF8; } byte[] usernamePassword; try { usernamePassword = (username + ":" + password).getBytes((String) charset); } catch (UnsupportedEncodingException e) { throw new CmisRuntimeException("Unsupported encoding '" + charset + "'!", e); } return Collections.singletonList("Basic " + Base64.encodeBytes(usernamePassword)); }
/** * Creates a basic authentication header value from a username and a * password. */ protected List<String> createBasicAuthHeaderValue(String username, String password) { if (password == null) { password = ""; } Object charset = getSession().get(SessionParameter.AUTH_HTTP_BASIC_CHARSET); if (charset instanceof String) { charset = ((String) charset).trim(); } else { charset = IOUtils.UTF8; } byte[] usernamePassword; try { usernamePassword = (username + ":" + password).getBytes((String) charset); } catch (UnsupportedEncodingException e) { throw new CmisRuntimeException("Unsupported encoding '" + charset + "'!", e); } return Collections.singletonList("Basic " + Base64.encodeBytes(usernamePassword)); }
return Base64.encodeBytes(token);