Loading common/java/com/android/common/Base64.java +7 −0 Original line number Diff line number Diff line Loading @@ -51,6 +51,13 @@ public class Base64 { */ public static final int WEB_SAFE = 8; /** * Flag to pass to Base64OutputStream to indicate that it should * not close the output stream it is wrapping when it itself is * closed. */ public static final int NO_CLOSE = 16; // -------------------------------------------------------- // decoding // -------------------------------------------------------- Loading common/java/com/android/common/Base64OutputStream.java +7 −1 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ public class Base64OutputStream extends FilterOutputStream { private final boolean encode; private final Base64.EncoderState estate; private final Base64.DecoderState dstate; private final int flags; private byte[] buffer = null; private int bpos = 0; Loading Loading @@ -59,6 +60,7 @@ public class Base64OutputStream extends FilterOutputStream { */ public Base64OutputStream(OutputStream out, int flags, boolean encode) { super(out); this.flags = flags; this.encode = encode; if (encode) { estate = new Base64.EncoderState(flags, null); Loading Loading @@ -106,7 +108,11 @@ public class Base64OutputStream extends FilterOutputStream { public void close() throws IOException { flushBuffer(); internalWrite(EMPTY, 0, 0, true); if ((flags & Base64.NO_CLOSE) == 0) { out.close(); } else { out.flush(); } } /** Loading Loading
common/java/com/android/common/Base64.java +7 −0 Original line number Diff line number Diff line Loading @@ -51,6 +51,13 @@ public class Base64 { */ public static final int WEB_SAFE = 8; /** * Flag to pass to Base64OutputStream to indicate that it should * not close the output stream it is wrapping when it itself is * closed. */ public static final int NO_CLOSE = 16; // -------------------------------------------------------- // decoding // -------------------------------------------------------- Loading
common/java/com/android/common/Base64OutputStream.java +7 −1 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ public class Base64OutputStream extends FilterOutputStream { private final boolean encode; private final Base64.EncoderState estate; private final Base64.DecoderState dstate; private final int flags; private byte[] buffer = null; private int bpos = 0; Loading Loading @@ -59,6 +60,7 @@ public class Base64OutputStream extends FilterOutputStream { */ public Base64OutputStream(OutputStream out, int flags, boolean encode) { super(out); this.flags = flags; this.encode = encode; if (encode) { estate = new Base64.EncoderState(flags, null); Loading Loading @@ -106,7 +108,11 @@ public class Base64OutputStream extends FilterOutputStream { public void close() throws IOException { flushBuffer(); internalWrite(EMPTY, 0, 0, true); if ((flags & Base64.NO_CLOSE) == 0) { out.close(); } else { out.flush(); } } /** Loading