IP Library Granted Patent US 7,561,079
Granted Patent B2
US 7,561,079 · App. 11/961,170 · Granted Jul 14, 2009

Method and apparatus for encoding a bytestream in a communication device

Assignee: Research In Motion Limited
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 7,561,079
App. No.
11/961,170
Granted
Jul 14, 2009
Kind
B2
Abstract

A method and apparatus for data encoding such as 3 to 4 encoding (base64, uuencode etc.) is provided. Bytes of data to be encoded having negative values are made positive while preserving the information to be encoded. The positive values may be manipulated by addition (e.g. to a common store) and bit shifting to efficiently obtain encoded data such as by indexing an encoding alphabet.

Claims (55)

1. A method for encoding a bytestream in a data communication device, the method comprising:

obtaining successive portions of the bytestream, each said successive portion being three bytes in length and comprising at least one byte of signed data in two's complement representation;

for each said successive three-byte portion, using a first Base64 encoding operation to encode the successive three-byte portion, the first Base64 encoding operation comprising steps of: converting each said at least one byte of signed data to a respective data store; for each said at least one byte of signed data having a negative value, adding 256 to the respective data store; collecting each said data store into a respective portion of a common store in accordance with an order of the respective byte in the successive three-byte portion, the common store being four bytes in length; and encoding successive 6-bit portions of the common store using a Base64 alphabet to obtain a portion of encoded byte data,

and appending the portion of encoded byte data to an output;

obtaining any remaining portion of the bytestream, said remaining portion being one or two bytes in length and comprising at least one byte of signed data in two's complement representation;

for the remaining one or two-byte portion, using a second Base64 encoding operation to encode the remaining one or two-byte portion, the second Base64 encoding operation comprising steps of: converting each said at least one byte of signed data to a respective data store; for each said at least one byte of signed data having a negative value, adding 256 to the respective data store; collecting each said data store into a respective portion of a common store in accordance with an order of the respective byte in the remaining one or two-byte portion; encoding successive 6-bit portions of the common store using a Base64 alphabet to obtain encoded byte data; and padding the encoded byte data to obtain a remaining portion of encoded byte data,

and appending the remaining portion of encoded byte data to the output; and

transmitting the output over a communications network to another data communications device.

2. The method of claim 1 wherein the output is provided as a string data type.

3. The method of claim 1 , wherein a data type of each data store is the same as that of the common store.

4. The method of claim 1 , wherein a data type is an ‘integer’ data type.

5. The method of claim 1 , wherein the first Base64 encoding operation step of collecting each said data store into a respective portion of the common store comprises, for each said data store:

calculating a starting bit position based on the order of the respective byte in the successive three-byte portion;

and adding the data store into the common store beginning at the calculated starting bit position.

6. The method of claim 1 , wherein the first Base64 encoding operation step of encoding each said successive 6-bit portion of the common store comprises steps of:

extracting each said successive 6-bit portion from the common store; and

mapping the extracted 6-bit portion to a corresponding character of the Base64 alphabet.

7. The method of claim 6 , wherein the step of extracting each said successive 6-bit portion from the common store comprises steps of:

bit shifting the common store;

and bit masking the bit-shifted common store.

8. The method of claim 1 , wherein the second Base64 encoding operation step of collecting each said data store into a respective portion of the common store comprises, for each said data store:

calculating a starting bit position based on the order of the respective byte in the remaining one or two-byte portion;

and adding the data store into the common store beginning at the calculated starting bit position.

9. The method of claim 1 , wherein the second Base64 encoding operation step of encoding each said successive 6-bit portion of the common store comprises steps of:

extracting each said successive 6-bit portion from the common store; and

mapping the extracted 6-bit portion to a corresponding character of the Base64 alphabet.

10. The method of claim 1 , wherein the step of padding the encoded byte data comprises steps of: determining a number of bytes of signed data within the remaining one or two-byte portion of the bytestream; determining a required number of padding characters, the required number being three minus the number of bytes of signed data; and inserting the required number of a predetermined padding character of the Base64 alphabet into the encoded byte data.

11. An apparatus for encoding data comprising a processor and a memory coupled to the processor, the memory storing machine-readable instructions for controlling the processor to:

obtain successive portions of the bytestream, each said successive portion being three bytes in length and comprising at least one byte of signed data in two's complement representation;

for each said successive three-byte portion, use a first Base64 encoding operation to encode the successive three-byte portion, the first Base64 encoding operation comprising steps of: converting each said at least one byte of signed data to a respective data store; for each said at least one byte of signed data having a negative value, adding 256 to the respective data store;

collecting each said data store into a respective portion of a common store in accordance with an order of the respective byte in the successive three-byte portion, the common store being four bytes in length; and encoding successive 6-bit portions of the common store using a Base64 alphabet to obtain a portion of encoded byte data, and

append the portion of encoded byte data to an output;

obtain any remaining portion of the bytestream, said remaining portion being one or two bytes in length and comprising at least one byte of signed data in two's complement representation;

for the remaining one or two-byte portion, use a second Base64 encoding operation to encode the remaining one or two-byte portion, the second Base64 encoding operation comprising steps of: converting each said at least one byte of signed data to a respective data store; for each said at least one byte of signed data having a negative value, adding 256 to the respective data store; collecting each said data store into a respective portion of a common store in accordance with an order of the respective byte in the remaining one or two-byte portion; encoding successive 6-bit portions of the common store using a Base64 alphabet to obtain encoded byte data; and padding the encoded byte data to obtain a remaining portion of encoded byte data, and

append the remaining portion of encoded byte data to the output; and

transmit the output over a communications network to a data communications device.

12. The apparatus of claim 11 , wherein the output is provided as a string data type.

13. The apparatus of claim 11 , wherein a data type of each data store is the same as that of the common store.

14. The apparatus of claim 11 , wherein a data type is an ‘integer’ data type.

15. The apparatus of claim 11 , wherein the first Base64 encoding operation step of collecting each said data store into a respective portion of the common store comprises, for each said data store:

calculating a starting bit position based on the order of the respective byte in the successive three-byte portion of data;

and adding the data store into the common store beginning at the calculated starting bit position.

16. The apparatus of claim 11 , wherein the first Base64 encoding operation step of encoding each said successive 6-bit portion of the common store comprises steps of:

extracting each said successive 6-bit portion from the common store; and

mapping the extracted 6-bit portion to a corresponding character of the Base64 alphabet.

17. The apparatus of claim 16 , wherein extracting each said successive 6-bit portion from the common store comprises steps of:

bit shifting the common store;

and bit masking the bit-shifted common store.

18. The apparatus of claim 11 , wherein the second Base64 encoding operation step of collecting each said data store into a respective portion of the common store comprises, for each said data store:

calculating a starting bit position based on the order of the respective byte in the remaining one or two-byte portion;

and adding the data store into the common store beginning at the calculated starting bit position.

19. The apparatus of claim 11 , wherein the second Base64 encoding operation step of encoding each said successive 6-bit portion of the common store comprises steps of:

extracting each said successive 6-bit portion from the common store; and

mapping the extracted 6-bit portion to a corresponding character of the Base64 alphabet.

20. The apparatus of claim 11 , wherein the step of padding the encoded byte data comprises steps of: determining a number of bytes of signed data within the remaining one-byte or two byte portion; determining a required number of padding characters, the required number being three minus the number of bytes of signed data; and inserting the required number of a predetermined padding character of the Base64 alphabet into the encoded byte data.

Assignments (3)
NUNC PRO TUNC ASSIGNMENT Recorded Jun 19, 2023
From: BLACKBERRY LIMITED
To: MALIKIE INNOVATIONS LIMITED
Reel/Frame 064269/0001 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jun 16, 2023
From: BLACKBERRY LIMITED
To: MALIKIE INNOVATIONS LIMITED
Reel/Frame 064104/0103 →
CHANGE OF NAME Recorded Nov 6, 2014
From: RESEARCH IN MOTION LIMITED
To: BLACKBERRY LIMITED
Reel/Frame 034179/0923 →
Continuity (3)
Continuation 1176691700 · Jun 22, 2007
Continuation 1106482300 · Feb 25, 2005
Related Publication 20080122663A1 · May 29, 2008