Is it possible to base64-encode a file in chunks?

前端 未结 3 1522
隐瞒了意图╮
隐瞒了意图╮ 2020-12-02 21:23

I\'m trying to base64 encode a huge input file and end up with an text output file, and I\'m trying to find out whether it\'s possible to encode the input file bit-by-bit, o

3条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-02 22:03

    Hmmm, if you wrote the base64 conversion yourself you should have noticed the obvious thing: each sequence of 3 octets is represented by 4 characters in base64.

    So you can split the base64 data at every multiple of four characters, and it will be possible to convert these chunks back to their original bits.

    I don't know how character files and byte files are handled on an AS/400, but if it has both concepts, this should be very easy.

    • are text files limited in the length of each line?
    • are text files line-oriented, or are they just character streams?
    • how many bits does one byte have?
    • are byte files padded at the end, so that one can only create files that span whole disk sectors?

    If you can answer all these questions, what exact difficulties do you have left?

提交回复
热议问题