Class Index | File Index

Classes


Class weasel.Base64Stream


Defined in: Base64Stream.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Object to stream encode bytes/ints into a Base64 string.
Field Summary
Field Attributes Field Name and Description
 
Lookup table of Base64 tokens for easy conversion of byte array to Base64, might be improved by using a 12bit to Base64 pair of chars as opposed to 6bit to single Base64 char.
Method Summary
Method Attributes Method Name and Description
 
appendByte(iByte)
Append a byte to the Base64 stream.
 
appendTriple(i3Bytes)
Append 3 bytes at once to the stream, this is to reduce the overheads of calling appendByte() 3 times.
 
appendWord(iWord)
Append 2 bytes at once to the stream, this is to reduce the overheads of calling appendByte() 2 times.
 
Complete the Base64 stream (flush all remaining bits and append terminators).
 
Get the generated base encoded string, you should have called flush() before using this.
 
load()
Load the previously saved state of the base 64 encoding.
 
prepend(sString)
Add a non-encoded string to the beginning of the Base64 encoded string, such as the dataURI header.
 
save()
Save the current state of the base 64 encoding, if you have already saved the state it will be overwritten.
Class Detail
weasel.Base64Stream()
Object to stream encode bytes/ints into a Base64 string.
Author: Warren Willmey 2012.
Field Detail
aBase64Tokens
Lookup table of Base64 tokens for easy conversion of byte array to Base64, might be improved by using a 12bit to Base64 pair of chars as opposed to 6bit to single Base64 char.
Method Detail
appendByte(iByte)
Append a byte to the Base64 stream.
Parameters:
{int} iByte
= Byte of data to append to the stream.

appendTriple(i3Bytes)
Append 3 bytes at once to the stream, this is to reduce the overheads of calling appendByte() 3 times.
Parameters:
{int} i3Bytes
= The 3 bytes you want to append to the stream in format 0x112233.

appendWord(iWord)
Append 2 bytes at once to the stream, this is to reduce the overheads of calling appendByte() 2 times.
Parameters:
{int} iWord
= The 2 bytes you want to append to the stream in format 0x1122.

flush()
Complete the Base64 stream (flush all remaining bits and append terminators).

{string} getBase64EncodedString()
Get the generated base encoded string, you should have called flush() before using this.
Returns:
{string} = The base64 encoded byte stream.

load()
Load the previously saved state of the base 64 encoding.

prepend(sString)
Add a non-encoded string to the beginning of the Base64 encoded string, such as the dataURI header.
Parameters:
{string} sString
= The string to prepend.

save()
Save the current state of the base 64 encoding, if you have already saved the state it will be overwritten.

Documentation generated by JsDoc Toolkit 2.4.0 on Mon Mar 05 2018 18:46:30 GMT-0000 (GMT)