/** * Encodes up to the first three bytes of array <var>threeBytes</var> and * returns a four-byte array in Base64 notation. The actual number of * significant bytes in your array is given by <var>numSigBytes</var>. The * array <var>threeBytes</var> needs only be as big as <var>numSigBytes</var>. * Code can reuse a byte array by passing a four-byte array as <var>b4</var>. * * @param b4 A reusable byte array to reduce array instantiation * @param threeBytes the array to convert * @param numSigBytes the number of significant bytes in your array * @param options options for get alphabet * @return four byte array in Base64 notation. * @since 1.5.1 */ protected static byte[] encode3to4(byte[] b4, byte[] threeBytes, int numSigBytes, int options) { encode3to4(threeBytes, 0, numSigBytes, b4, 0, options); return b4; } // end encode3to4
/** * Encodes up to the first three bytes of array <var>threeBytes</var> and * returns a four-byte array in Base64 notation. The actual number of * significant bytes in your array is given by <var>numSigBytes</var>. The * array <var>threeBytes</var> needs only be as big as <var>numSigBytes</var>. * Code can reuse a byte array by passing a four-byte array as <var>b4</var>. * * @param b4 A reusable byte array to reduce array instantiation * @param threeBytes the array to convert * @param numSigBytes the number of significant bytes in your array * @param options options for get alphabet * @return four byte array in Base64 notation. * @since 1.5.1 */ protected static byte[] encode3to4(byte[] b4, byte[] threeBytes, int numSigBytes, int options) { encode3to4(threeBytes, 0, numSigBytes, b4, 0, options); return b4; } // end encode3to4
/** * Encodes up to the first three bytes of array <var>threeBytes</var> and * returns a four-byte array in Base64 notation. The actual number of * significant bytes in your array is given by <var>numSigBytes</var>. The * array <var>threeBytes</var> needs only be as big as <var>numSigBytes</var>. * Code can reuse a byte array by passing a four-byte array as <var>b4</var>. * * @param b4 A reusable byte array to reduce array instantiation * @param threeBytes the array to convert * @param numSigBytes the number of significant bytes in your array * @param options options for get alphabet * @return four byte array in Base64 notation. * @since 1.5.1 */ protected static byte[] encode3to4(byte[] b4, byte[] threeBytes, int numSigBytes, int options) { encode3to4(threeBytes, 0, numSigBytes, b4, 0, options); return b4; } // end encode3to4
/** * Method added by PHIL. [Thanks, PHIL. -Rob] This pads the buffer without * closing the stream. * * @throws IOException e */ public void flushBase64() throws IOException { if (position > 0) { if (encode) { out.write(encode3to4(b4, buffer, position, options)); position = 0; } else { throw new IOException("Base64 input not properly padded."); } // end else: decoding } // end if: buffer partially full } // end flush
/** * Method added by PHIL. [Thanks, PHIL. -Rob] This pads the buffer without * closing the stream. * * @throws IOException e */ public void flushBase64() throws IOException { if (position > 0) { if (encode) { out.write(encode3to4(b4, buffer, position, options)); position = 0; } else { throw new IOException("Base64 input not properly padded."); } // end else: decoding } // end if: buffer partially full } // end flush
/** * Method added by PHIL. [Thanks, PHIL. -Rob] This pads the buffer without * closing the stream. * * @throws IOException e */ public void flushBase64() throws IOException { if (position > 0) { if (encode) { out.write(encode3to4(b4, buffer, position, options)); position = 0; } else { throw new IOException("Base64 input not properly padded."); } // end else: decoding } // end if: buffer partially full } // end flush
buffer[position++] = (byte) theByte; if (position >= bufferLength) { // Enough to encode. out.write(encode3to4(b4, buffer, bufferLength, options)); lineLength += 4; if (breakLines && lineLength >= MAX_LINE_LENGTH) {
buffer[position++] = (byte) theByte; if (position >= bufferLength) { // Enough to encode. out.write(encode3to4(b4, buffer, bufferLength, options)); lineLength += 4; if (breakLines && lineLength >= MAX_LINE_LENGTH) {
buffer[position++] = (byte) theByte; if (position >= bufferLength) { // Enough to encode. out.write(encode3to4(b4, buffer, bufferLength, options)); lineLength += 4; if (breakLines && lineLength >= MAX_LINE_LENGTH) {
encode3to4(b3, 0, numBinaryBytes, buffer, 0, options); position = 0; numSigBytes = 4;
encode3to4(b3, 0, numBinaryBytes, buffer, 0, options); position = 0; numSigBytes = 4;
int lineLength = 0; for (; d < len2; d += 3, e += 4) { encode3to4(source, d + off, 3, outBuff, e, options); encode3to4(source, d + off, len - d, outBuff, e, options); e += 4;
encode3to4(b3, 0, numBinaryBytes, buffer, 0, options); position = 0; numSigBytes = 4;
int lineLength = 0; for (; d < len2; d += 3, e += 4) { encode3to4(source, d + off, 3, outBuff, e, options); encode3to4(source, d + off, len - d, outBuff, e, options); e += 4;
int lineLength = 0; for (; d < len2; d += 3, e += 4) { encode3to4(source, d + off, 3, outBuff, e, options); encode3to4(source, d + off, len - d, outBuff, e, options); e += 4;