aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes getBytes() deprecated method.. Am I missing something ? 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 "getBytes() deprecated method.. Am I missing something ?" Watch "getBytes() deprecated method.. Am I missing something ?" New topic
Author

getBytes() deprecated method.. Am I missing something ?

Krishna Varma Adluru
Ranch Hand

Joined: Nov 24, 2001
Posts: 55
To change deprecated getBytes(int srcBegin, int srcEnd, byte[] dst, int dstBegin) method
in writeRecord() of the Data class, I changed the source code FROM
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);

offset += space;
}
TO
for (int i = 0; i < description.length; i++) {
space = description[i].getLength();
size = newData[i].length();
toCopy = (size <= space) ? size : space;
byte[] tmpBuffer = newData[i].getBytes();
System.arraycopy(tmpBuffer, 0, buffer, offset, toCopy);

offset += space;
}
Did I do anything wrong here ? Am I missing something ?
It works fine though...But, I am not sure whether it
works in all the cases !!!
[ April 11, 2002: Message edited by: Krishna Varma Adluru ]
Rama Ituarte
Ranch Hand

Joined: Apr 10, 2002
Posts: 62
Looks good to me. Why do you think it won't work for all cases?
Krishna Varma Adluru
Ranch Hand

Joined: Nov 24, 2001
Posts: 55
Some people were saying that we need to use
ASCII encoding ...
I am using default encoding
Regards,
Krishna Varma Adluru
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi Krishna,
I'm using default also. Mark used default, many others used UTF-8 (which as Mark pointed out is the default), and I'm only aware of a few who used ASCII.
Michael Morris
[ April 11, 2002: Message edited by: Michael Morris ]
[ April 11, 2002: Message edited by: Michael Morris ]

Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Krishna Varma Adluru
Ranch Hand

Joined: Nov 24, 2001
Posts: 55
Thanks everyone
Regards,
Krishna
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: getBytes() deprecated method.. Am I missing something ?