You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Julius Davies (JIRA)" <ji...@apache.org> on 2008/06/18 06:44:45 UTC
[jira] Created: (CODEC-69) Streaming Base64
Streaming Base64
----------------
Key: CODEC-69
URL: https://issues.apache.org/jira/browse/CODEC-69
Project: Commons Codec
Issue Type: Improvement
Reporter: Julius Davies
Priority: Minor
Fix For: 1.x
Would be nice to have Base64InputStream and Base64OutputStream, with both supporting ENCODE or DECODE modes.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CODEC-69) Streaming Base64
Posted by "Julius Davies (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CODEC-69?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12605828#action_12605828 ]
Julius Davies commented on CODEC-69:
------------------------------------
Related to CODEC-8, but I wasn't brave enough to try a general approach, and I need streaming Base64 urgently! (500MB+ files sometimes encrypted/decrypted in not-yet-commons-ssl!)
> Streaming Base64
> ----------------
>
> Key: CODEC-69
> URL: https://issues.apache.org/jira/browse/CODEC-69
> Project: Commons Codec
> Issue Type: Improvement
> Reporter: Julius Davies
> Priority: Minor
> Fix For: 1.x
>
> Attachments: streaming-base64.patch
>
>
> Would be nice to have Base64InputStream and Base64OutputStream, with both supporting ENCODE or DECODE modes.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CODEC-69) Streaming Base64
Posted by "Julius Davies (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CODEC-69?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12606451#action_12606451 ]
Julius Davies commented on CODEC-69:
------------------------------------
Thanks so much for accepting this patch!
I noticed some minor typos in some of my javadocs, and a spurious (byte) cast.... I'll probably upload an additional patch in a few days.
> Streaming Base64
> ----------------
>
> Key: CODEC-69
> URL: https://issues.apache.org/jira/browse/CODEC-69
> Project: Commons Codec
> Issue Type: Improvement
> Reporter: Julius Davies
> Assignee: Jochen Wiedmann
> Priority: Minor
> Fix For: 1.4
>
> Attachments: streaming-base64.patch
>
>
> Would be nice to have Base64InputStream and Base64OutputStream, with both supporting ENCODE or DECODE modes.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CODEC-69) Streaming Base64
Posted by "Julius Davies (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CODEC-69?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12606462#action_12606462 ]
Julius Davies commented on CODEC-69:
------------------------------------
Oops - Base64 constructors are not public. In previous version there was no declared constructor, which is identical to having "public Base64() {}".
The constructors need to be public to support anyone who is using the "BinaryEncoder" or "BinaryDecoder" interfaces instead of using Base64 directly.
> Streaming Base64
> ----------------
>
> Key: CODEC-69
> URL: https://issues.apache.org/jira/browse/CODEC-69
> Project: Commons Codec
> Issue Type: Improvement
> Reporter: Julius Davies
> Assignee: Jochen Wiedmann
> Priority: Minor
> Fix For: 1.4
>
> Attachments: streaming-base64.patch
>
>
> Would be nice to have Base64InputStream and Base64OutputStream, with both supporting ENCODE or DECODE modes.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CODEC-69) Streaming Base64
Posted by "Sebb (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CODEC-69?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12606491#action_12606491 ]
Sebb commented on CODEC-69:
---------------------------
Base64 constructors have been made public:
URL: http://svn.apache.org/viewvc?rev=669616&view=rev
Log:
CODEC-69 (part) - make Base64 constructors public
> Streaming Base64
> ----------------
>
> Key: CODEC-69
> URL: https://issues.apache.org/jira/browse/CODEC-69
> Project: Commons Codec
> Issue Type: Improvement
> Reporter: Julius Davies
> Assignee: Jochen Wiedmann
> Priority: Minor
> Fix For: 1.4
>
> Attachments: streaming-base64.patch
>
>
> Would be nice to have Base64InputStream and Base64OutputStream, with both supporting ENCODE or DECODE modes.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (CODEC-69) Streaming Base64
Posted by "Julius Davies (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CODEC-69?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Julius Davies updated CODEC-69:
-------------------------------
Attachment: streaming-base64.patch
Patch introduces Base64InputStream and Base64OutputStream. They wrap any pre-existing InputStream or OutputStream, like so:
InputStream in = new FileInputStream("/path/to/file.base64");
in = new Base64InputStream(in, false); // false == DECODE
The guts of Base64 have been ripped out and rearranged to better suit this way of working, but all the JUnit tests still pass!
Thanks to "commons" project in ws.apache.org for much of this code.
http://svn.apache.org/repos/asf/webservices/commons/trunk/modules/util/
> Streaming Base64
> ----------------
>
> Key: CODEC-69
> URL: https://issues.apache.org/jira/browse/CODEC-69
> Project: Commons Codec
> Issue Type: Improvement
> Reporter: Julius Davies
> Priority: Minor
> Fix For: 1.x
>
> Attachments: streaming-base64.patch
>
>
> Would be nice to have Base64InputStream and Base64OutputStream, with both supporting ENCODE or DECODE modes.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (CODEC-69) Streaming Base64
Posted by "Jochen Wiedmann (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CODEC-69?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jochen Wiedmann resolved CODEC-69.
----------------------------------
Resolution: Fixed
Fix Version/s: (was: 1.x)
1.4
Assignee: Jochen Wiedmann
Applied. There is, of course, CODEC-8, but IMO this is so far the best piece of code that commons-codec has seen, so that we may think about the API later on.
> Streaming Base64
> ----------------
>
> Key: CODEC-69
> URL: https://issues.apache.org/jira/browse/CODEC-69
> Project: Commons Codec
> Issue Type: Improvement
> Reporter: Julius Davies
> Assignee: Jochen Wiedmann
> Priority: Minor
> Fix For: 1.4
>
> Attachments: streaming-base64.patch
>
>
> Would be nice to have Base64InputStream and Base64OutputStream, with both supporting ENCODE or DECODE modes.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CODEC-69) Streaming Base64
Posted by "Julius Davies (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CODEC-69?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12606470#action_12606470 ]
Julius Davies commented on CODEC-69:
------------------------------------
To reply to Sebb's comment on CODEC-8:
Base64 encoding will only emit bytes in chunks of 4.
For example:
1. read a byte... nothing emitted
2. read a byte... nothing emitted
3. read a byte... 4 bytes emitted.
4. read a byte... nothing emitted.
5. EOF! 4 bytes emitted (e.g. AA==).
So even if a "lineLength" of 75 is passed to the constructor, the lines will still be 76 characters long. Not because we ever actually round the number up, but because of this part of the encode() method (the += 4 in particular):
{code}
buf[pos++] = intToBase64[(x >> 18) & 0x3f];
buf[pos++] = intToBase64[(x >> 12) & 0x3f];
buf[pos++] = intToBase64[(x >> 6) & 0x3f];
buf[pos++] = intToBase64[x & 0x3f];
currentLinePos += 4;
if (lineLength > 0 && lineLength <= currentLinePos) {
System.arraycopy(lineSeparator, 0, buf, pos, lineSeparator.length);
pos += lineSeparator.length;
currentLinePos = 0;
}
{code}
I can't think of a good name for this magic number! Maybe ENCODE_UNIT ?
> Streaming Base64
> ----------------
>
> Key: CODEC-69
> URL: https://issues.apache.org/jira/browse/CODEC-69
> Project: Commons Codec
> Issue Type: Improvement
> Reporter: Julius Davies
> Assignee: Jochen Wiedmann
> Priority: Minor
> Fix For: 1.4
>
> Attachments: streaming-base64.patch
>
>
> Would be nice to have Base64InputStream and Base64OutputStream, with both supporting ENCODE or DECODE modes.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.