IP Library Granted Patent US 7,162,712
Granted Patent B2
US 7,162,712 · App. 10/351,106 · Granted Jan 9, 2007

Method and apparatus for creating string objects in a programming language

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,162,712
App. No.
10/351,106
Granted
Jan 9, 2007
Kind
B2
Abstract

One embodiment of the present invention provides a system for implementing a string object defined in a programming language. Upon receiving characters to be embedded in the string object, the system allocates space for the string object that includes a header, which is appended to a character array of the string object. Next, the system copies the characters into the character array of the string object. The system also initializes the header by initializing a class pointer in the header to point to a class for the string object, and by initializing a length field in the header to specify a length for the string object. In this way, the string object remains compatible with previous implementations of the string object that use a character array that is separate from the string object.

Claims (28)

1. A method for implementing a string object defined in a programming language, comprising:

receiving characters to be embedded in the string object;

allocating a space for a string buffer, wherein the space includes a header which is appended to a character array of the string buffer;

copying the characters into the character array of the string buffer;

converting the string buffer into the string object without allocating memory for a separate string object, wherein converting the string buffer into the string object reduces a memory footprint of the string object; and

initializing the header by initializing a class pointer in the header to point to a class for the string object, and by initializing a length field in the header to specify a length for the string object;

whereby the string object remains compatible with previous implementations of string objects that use a separate character array.

2. The method of claim 1 , wherein characters within the character array are encoded in a sixteen-bit standard character code.

3. The method of claim 1 , wherein characters within the character array are encoded in an eight-bit standard character code.

4. The method of claim 1 , wherein characters within the character array are encoded in a variable-length standard character code.

5. The method of claim 1 , wherein the character array is created by first assuming that characters to be added to the character array can be encoded in an eight-bit representation.

6. The method of claim 5 , wherein if characters are encountered that will not fit in the eight-bit representation, the character array is converted to use a sixteen-bit representation.

7. The method of claim 6 , further comprising converting the character array to use a variable-length representation, whereby the variable-length representation saves storage space.

8. The method of claim 1 , further comprising moving a class pointer to convert the character array into a string object instead of copying the string object.

9. A tangible computer-readable storage medium storing instructions that when executed by a computer cause the computer to perform a method for implementing a string object defined in a programming language, the method comprising:

receiving characters to be embedded in the string object;

allocating a space for a string buffer, wherein the space includes a header which is appended to a character array of the string buffer;

copying the characters into the character array of the string buffer;

converting the string buffer into the string object without allocating memory for a separate string object, wherein converting the string buffer into the string object reduces a memory footprint of the string object; and

initializing the header by initializing a class pointer in the header to point to a class for the string object, and by initializing a length field in the header to specify a length for the string object;

whereby the string object remains compatible with previous implementations of string objects that use a separate character array.

10. The tangible computer-readable storage medium of claim 9 , wherein characters within the character array are encoded in a sixteen-bit standard character code.

11. The tangible computer-readable storage medium of claim 9 , wherein characters within the character array are encoded in an eight-bit standard character code.

12. The tangible computer-readable storage medium of claim 9 , wherein characters within the character array are encoded in a variable-length standard character code.

13. The tangible computer-readable storage medium of claim 9 , wherein the character array is created by first assuming that characters to be added to the character array can be encoded in an eight-bit representation.

14. The tangible computer-readable storage medium of claim 13 , wherein if characters are encountered that will not fit in the eight-bit representation, the character array is converted to use a sixteen-bit representation.

15. The tangible computer-readable storage medium of claim 14 , the method further comprising converting the character array to use a variable-length representation, whereby the variable-length representation saves storage space.

16. The tangible computer-readable storage medium of claim 9 , the method further comprising moving a class pointer to convert the character array into a string object instead of copying the string object.

Assignments (1)
MERGER AND CHANGE OF NAME Recorded Dec 16, 2015
From: ORACLE USA, INC.; SUN MICROSYSTEMS, INC.; ORACLE AMERICA, INC.
To: ORACLE AMERICA, INC.
Reel/Frame 037302/0683 →