jQuery in Action, 3rd edition
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes URLBirdy(1.3.2)  Create method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "URLBirdy(1.3.2)  Create method " Watch "URLBirdy(1.3.2)  Create method " New topic

URLBirdy(1.3.2) Create method

vijay selvaganapathy

Joined: Jul 08, 2005
Posts: 14
Hi all,
I require your advice on the foll.
(1) I tried to use the foll. code but could not make it work( in create() method)

The compiler throws ArrayIndexOutofBoundsException for field_max_length as the byteArray stores the string bytes upto the length of the string only.

data is the formal parameter in the create method and count keeps track of the number of fields.

(2) This was my alternative to the above code
I have the following code in my test create method:

data is the formal parameter in the create method and count keeps track of the number of fields.

The problem with this code is creates a new byte array each time as i iterate thro the 7 fields. This is the only way that i could create the byte array of size max field_length.The program works (for now!!) ,but i feel there is performance penalty involved.

(1) Is there any other way of writing the bytearray to the file without creating a new byte array i.e i want to avoid line (1) of the above code.

(2) The methods contract specifies it should return a rec_num, (Do we have to have a pool of rec_nums and select one and assign to it?)

For initial testing purpose, i want to insert the record at the end of the file.

Eagerly expecting ur reply,


[Andrew: Tried to wrap code so that horizontal scrolling no longer required. I have triple checked this, and I don't believe I have introduced any errors, but I don't think this code will compile either ]
[ July 14, 2005: Message edited by: Andrew Monkhouse ]
Mihai Radulescu
Ranch Hand

Joined: Sep 18, 2003
Posts: 918


If i uderstand you try to write a record (and to pad it with null character if the new field size is smaller then the field size).
For this I have the a special method to pad the record field and other to write it.For padding I use the String & StringBuffer feaures adn for writer i use the

from RAF.


[ July 14, 2005: Message edited by: Mihai Radulescu ]

I agree. Here's the link: http://aspose.com/file-tools
subject: URLBirdy(1.3.2) Create method
It's not a secret anymore!