b64os = new Base64.OutputStream(baos, ENCODE | options); gzos = new java.util.zip.GZIPOutputStream(b64os); if (b64os != null) b64os.close(); } catch (Exception e) {
/** * Flushes and closes (I think, in the superclass) the stream. * * @since 1.3 */ @Override public void close() throws java.io.IOException { // 1. Ensure that pending characters are written flushBase64(); // 2. Actually close the stream // Base class both flushes and closes. super.close(); buffer = null; out = null; } // end close
/** * Convenience method for decoding data to a file. * <p> * As of v 2.3, if there is a error, the method will throw an java.io.IOException. <b>This is new to v2.3!</b> In earlier * versions, it just returned false, but in retrospect that's a pretty poor way to handle it. * </p> * * @param dataToDecode Base64-encoded data as a string * @param filename Filename for saving decoded data * @throws java.io.IOException if there is an error * @since 2.1 */ public static void decodeToFile( String dataToDecode, String filename ) throws java.io.IOException { Base64.OutputStream bos = null; try { bos = new Base64.OutputStream(new java.io.FileOutputStream(filename), Base64.DECODE); bos.write(dataToDecode.getBytes(PREFERRED_ENCODING)); } // end try catch (java.io.IOException e) { throw e; // Catch and throw to execute finally{} block } // end catch: java.io.IOException finally { try { if (bos != null) bos.close(); } catch (Exception e) { } } // end finally } // end decodeToFile
b64os = new Base64.OutputStream(baos, ENCODE | options); gzos = new java.util.zip.GZIPOutputStream(b64os); if (b64os != null) b64os.close(); } catch (Exception e) {
b64os = new Base64.OutputStream(baos, ENCODE | options); gzos = new java.util.zip.GZIPOutputStream(b64os); if (b64os != null) b64os.close(); } catch (Exception e) {
b64os = new Base64.OutputStream(baos, ENCODE | options); if ((options & GZIP) != 0) {
b64os = new Base64.OutputStream(baos, ENCODE | options); if ((options & GZIP) != 0) {
b64os = new Base64.OutputStream(baos, ENCODE | options); if ((options & GZIP) != 0) {
CheckArg.isNotNull(source, "source"); java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream(); Base64.OutputStream b64os = new Base64.OutputStream(baos, ENCODE | options); BufferedInputStream input = new BufferedInputStream(source); java.io.OutputStream output = b64os;
CheckArg.isNotNull(source, "source"); java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream(); Base64.OutputStream b64os = new Base64.OutputStream(baos, ENCODE | options); BufferedInputStream input = new BufferedInputStream(source); java.io.OutputStream output = b64os;
CheckArg.isNotNull(source, "source"); java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream(); Base64.OutputStream b64os = new Base64.OutputStream(baos, ENCODE | options); BufferedInputStream input = new BufferedInputStream(source); java.io.OutputStream output = b64os;
bos = new Base64.OutputStream(new java.io.FileOutputStream(filename), Base64.ENCODE); bos.write(dataToEncode); if (bos != null) bos.close(); } catch (Exception e) {
/** * Convenience method for decoding data to a file. * <p> * As of v 2.3, if there is a error, the method will throw an java.io.IOException. <b>This is new to v2.3!</b> In earlier * versions, it just returned false, but in retrospect that's a pretty poor way to handle it. * </p> * * @param dataToDecode Base64-encoded data as a string * @param filename Filename for saving decoded data * @throws java.io.IOException if there is an error * @since 2.1 */ public static void decodeToFile( String dataToDecode, String filename ) throws java.io.IOException { Base64.OutputStream bos = null; try { bos = new Base64.OutputStream(new java.io.FileOutputStream(filename), Base64.DECODE); bos.write(dataToDecode.getBytes(PREFERRED_ENCODING)); } // end try catch (java.io.IOException e) { throw e; // Catch and throw to execute finally{} block } // end catch: java.io.IOException finally { try { if (bos != null) bos.close(); } catch (Exception e) { } } // end finally } // end decodeToFile
bos = new Base64.OutputStream(new java.io.FileOutputStream(filename), Base64.ENCODE); bos.write(dataToEncode); if (bos != null) bos.close(); } catch (Exception e) {
bos = new Base64.OutputStream(new java.io.FileOutputStream(filename), Base64.ENCODE); bos.write(dataToEncode); if (bos != null) bos.close(); } catch (Exception e) {
/** * Convenience method for decoding data to a file. * <p> * As of v 2.3, if there is a error, the method will throw an java.io.IOException. <b>This is new to v2.3!</b> In earlier * versions, it just returned false, but in retrospect that's a pretty poor way to handle it. * </p> * * @param dataToDecode Base64-encoded data as a string * @param filename Filename for saving decoded data * @throws java.io.IOException if there is an error * @since 2.1 */ public static void decodeToFile( String dataToDecode, String filename ) throws java.io.IOException { Base64.OutputStream bos = null; try { bos = new Base64.OutputStream(new java.io.FileOutputStream(filename), Base64.DECODE); bos.write(dataToDecode.getBytes(PREFERRED_ENCODING)); } // end try catch (java.io.IOException e) { throw e; // Catch and throw to execute finally{} block } // end catch: java.io.IOException finally { try { if (bos != null) bos.close(); } catch (Exception e) { } } // end finally } // end decodeToFile
/** * Calls {@link #write(int)} repeatedly until <var>len</var> bytes are written. * * @param theBytes array from which to read bytes * @param off offset for array * @param len max number of bytes to read into array * @since 1.3 */ @Override public void write( byte[] theBytes, int off, int len ) throws java.io.IOException { // Encoding suspended? if (suspendEncoding) { this.out.write(theBytes, off, len); return; } // end if: supsended for (int i = 0; i < len; i++) { write(theBytes[off + i]); } // end for: each byte written } // end write
/** * Calls {@link #write(int)} repeatedly until <var>len</var> bytes are written. * * @param theBytes array from which to read bytes * @param off offset for array * @param len max number of bytes to read into array * @since 1.3 */ @Override public void write( byte[] theBytes, int off, int len ) throws java.io.IOException { // Encoding suspended? if (suspendEncoding) { this.out.write(theBytes, off, len); return; } // end if: supsended for (int i = 0; i < len; i++) { write(theBytes[off + i]); } // end for: each byte written } // end write
/** * Calls {@link #write(int)} repeatedly until <var>len</var> bytes are written. * * @param theBytes array from which to read bytes * @param off offset for array * @param len max number of bytes to read into array * @since 1.3 */ @Override public void write( byte[] theBytes, int off, int len ) throws java.io.IOException { // Encoding suspended? if (suspendEncoding) { this.out.write(theBytes, off, len); return; } // end if: supsended for (int i = 0; i < len; i++) { write(theBytes[off + i]); } // end for: each byte written } // end write
/** * Flushes and closes (I think, in the superclass) the stream. * * @since 1.3 */ @Override public void close() throws java.io.IOException { // 1. Ensure that pending characters are written flushBase64(); // 2. Actually close the stream // Base class both flushes and closes. super.close(); buffer = null; out = null; } // end close