File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes modify method in Data Class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "modify method in Data Class" Watch "modify method in Data Class" New topic
Author

modify method in Data Class

raphael Bereh
Ranch Hand

Joined: Jan 15, 2002
Posts: 79
Hi,
In the FBN assignment I am trying to use the method public synchronized void modify(DataInfo newData) in the Data Class but it does not write the data as expected. The record writen is blank
Has Anyone used the method successfully ?
Thanks


SCJP,SCJD,SCBCD
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17257
    
    6

Have you checked the DataInfo class that you are passing in to the modify method. Check to see that is has values in it. Put System.outs in the modify method that will print the values of the DataInfo class that you pass.
Also did you change the deprecated method in the writeRecord method? This could also be important how you fixed it. I remember having a problem saving too, and I found that my solution to the deprecated method wasn't quite right.
Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
ravindra janapreddy
Ranch Hand

Joined: Jan 30, 2001
Posts: 84
I have the similar problem after invoking the modify method a blank record is being written to the db file. I have printed out the DataInfo object using System.out.println and it has all the values.
Please resolve the issue.
Thanks
Ravi


SCEA, SCBCD, SCWCD, SCJD, SCJP
Sai Prasad
Ranch Hand

Joined: Feb 25, 2002
Posts: 560
Looks like it has something to do with deprecated line in writeRecord() method.
ravindra janapreddy
Ranch Hand

Joined: Jan 30, 2001
Posts: 84
Hi Sai
This is my fix for the deprecated line. Is it wrong ?
for (int i = 0; i < description.length; i++) {
space = description[i].getLength();
size = newData[i].length();
toCopy = (size <= space) ? size : space;
//newData[i].getBytes(0, toCopy, buffer, offset);
String enc = "ISO-8859-1";
newData[i].getBytes( enc );
offset += space;
}
Thanks
Ravi
Sai Prasad
Ranch Hand

Joined: Feb 25, 2002
Posts: 560
Yes. You are missing two steps.
You need to figure out how much of newData[i] is to be converted to byte[].
Also you need to populate/copy the buffer[] with the above value.
Default encoding should be fine.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: modify method in Data Class