X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/28e192c519c59d97d70aea6fabe18927e1aff42a..ef5d3a65f8de2ae8e17adfb7c307d88b0c04778a:/src/main/java/cli/Base64.java diff --git a/src/main/java/cli/Base64.java b/src/main/java/cli/Base64.java index 061932ab..b2a28591 100644 --- a/src/main/java/cli/Base64.java +++ b/src/main/java/cli/Base64.java @@ -3,34 +3,34 @@ package cli; /** *
Encodes and decodes to and from Base64 notation.
*Homepage: http://iharder.net/base64.
- * + * *Example:
- * + * *String encoded = Base64.encode( myByteArray );
* byte[] myByteArray = Base64.decode( encoded );
- *
+ *
* The options parameter, which appears in a few places, is used to pass * several pieces of information to the encoder. In the "higher level" methods such as * encodeBytes( bytes, options ) the options parameter can be used to indicate such * things as first gzipping the bytes before encoding them, not inserting linefeeds, * and encoding using the URL-safe and Ordered dialects.
- * + * *Note, according to RFC3548, * Section 2.1, implementations should not add line feeds unless explicitly told * to do so. I've got Base64 set to this behavior now, although earlier versions * broke lines by default.
- * + * *The constants defined in Base64 can be OR-ed together to combine options, so you * might make a call like this:
- * + * *String encoded = Base64.encodeBytes( mybytes, Base64.GZIP | Base64.DO_BREAK_LINES );
* to compress the data before encoding it and then making the output have newline characters.
*Also...
*String encoded = Base64.encodeBytes( crazyString.getBytes() );
- *
- *
- *
+ *
+ *
+ *
* * Change Log: *
@@ -95,7 +95,7 @@ package cli; * Special thanks to Jim Kellerman at http://www.powerset.com/ * for contributing the new Base64 dialects. * - * + * ** I am placing this code in the Public Domain. Do with it as you will. * This software comes with no guarantees or warranties but with @@ -619,13 +619,13 @@ public class Base64 { /** * Serializes an object and returns the Base64-encoded * version of that serialized object. - *
+ * *As of v 2.3, if the object * cannot be serialized or there is another error, * the method will throw an java.io.IOException. This is new to v2.3! * In earlier versions, it just returned a null value, but * in retrospect that's a pretty poor way to handle it.
- *+ * * The object is not GZip-compressed before being encoded. * * @param serializableObject The object to encode @@ -643,22 +643,22 @@ public class Base64 { /** * Serializes an object and returns the Base64-encoded * version of that serialized object. - *
+ * *As of v 2.3, if the object * cannot be serialized or there is another error, * the method will throw an java.io.IOException. This is new to v2.3! * In earlier versions, it just returned a null value, but * in retrospect that's a pretty poor way to handle it.
- *+ * * The object is not GZip-compressed before being encoded. - *
+ * * Example options:
* GZIP: gzip-compresses object before encoding it. * DO_BREAK_LINES: break lines at 76 characters *- *
+ *
* Example: encodeObject( myObj, Base64.GZIP )
or
- *
+ *
* Example: encodeObject( myObj, Base64.GZIP | Base64.DO_BREAK_LINES )
*
* @param serializableObject The object to encode
@@ -793,8 +793,8 @@ public class Base64 {
* Example: encodeBytes( myData, Base64.GZIP )
or
*
* Example: encodeBytes( myData, Base64.GZIP | Base64.DO_BREAK_LINES )
- *
As of v 2.3, if there is an error with the GZIP stream, * the method will throw an java.io.IOException. This is new to v2.3! * In earlier versions, it just returned a null value, but @@ -817,7 +817,7 @@ public class Base64 { /** * Encodes a byte array into Base64 notation. * Does not GZip-compress data. - *
+ * *As of v 2.3, if there is an error,
* the method will throw an java.io.IOException. This is new to v2.3!
* In earlier versions, it just returned a null value, but
@@ -858,8 +858,8 @@ public class Base64 {
* Example: encodeBytes( myData, Base64.GZIP )
or
*
* Example: encodeBytes( myData, Base64.GZIP | Base64.DO_BREAK_LINES )
- *
As of v 2.3, if there is an error with the GZIP stream, * the method will throw an java.io.IOException. This is new to v2.3! * In earlier versions, it just returned a null value, but @@ -1455,7 +1455,7 @@ public class Base64 { /** * Convenience method for encoding data to a file. - *
+ * *As of v 2.3, if there is a error, * the method will throw an java.io.IOException. This is new to v2.3! * In earlier versions, it just returned false, but @@ -1495,7 +1495,7 @@ public class Base64 { /** * Convenience method for decoding data to a file. - *
+ * *As of v 2.3, if there is a error, * the method will throw an java.io.IOException. This is new to v2.3! * In earlier versions, it just returned false, but @@ -1531,7 +1531,7 @@ public class Base64 { /** * Convenience method for reading a base64-encoded * file and decoding it. - *
+ * *As of v 2.3, if there is a error, * the method will throw an java.io.IOException. This is new to v2.3! * In earlier versions, it just returned false, but @@ -1592,7 +1592,7 @@ public class Base64 { /** * Convenience method for reading a binary file * and base64-encoding it. - *
+ * *As of v 2.3, if there is a error, * the method will throw an java.io.IOException. This is new to v2.3! * In earlier versions, it just returned false, but @@ -1740,13 +1740,13 @@ public class Base64 { /** * Constructs a {@link Base64.InputStream} in * either ENCODE or DECODE mode. - *
+ * * Valid options:
* ENCODE or DECODE: Encode or Decode as data is read. * DO_BREAK_LINES: break lines at 76 characters * (only meaningful when encoding) *- *
+ *
* Example: new Base64.InputStream( in, Base64.DECODE )
*
* @param in the java.io.InputStream from which to read data.
@@ -1951,13 +1951,13 @@ public class Base64 {
/**
* Constructs a {@link Base64.OutputStream} in
* either ENCODE or DECODE mode.
- *
+ * * Valid options:
* ENCODE or DECODE: Encode or Decode as data is read. * DO_BREAK_LINES: don't break lines at 76 characters * (only meaningful when encoding) *- *
+ *
* Example: new Base64.OutputStream( out, Base64.ENCODE )
*
* @param out the java.io.OutputStream to which data will be written.