File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Groovy and the fly likes EBCDIC Conversion in groovy Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » Groovy
Bookmark "EBCDIC Conversion in groovy" Watch "EBCDIC Conversion in groovy" New topic

EBCDIC Conversion in groovy

Nishiru San

Joined: Feb 07, 2013
Posts: 3
I was trying for ASCII to EBCDIC conversion in groovy

I was trying to write hex value 81 and 82 ( which are EBCDIC hex values for a and b) to a file.

Please find the code below

But the code writes hex value 3F and 82 to the file. It seems that when i give byte(0x81) it is not resolving and putting 3F which means character '?' in ASCII. All other hex values are fine.

I have tried this in Windows 7 32 bit machine. Tried the same code in Oracle Enterprise 5 Linux 64 bit machine. Surprisingly the same code wrote 'EFBF EFBF' in the file .

Can someone advice on this.
Nishiru San

Joined: Feb 07, 2013
Posts: 3
Instead of f.write used f.setBytes to solve the issue
I agree. Here's the link:
subject: EBCDIC Conversion in groovy
It's not a secret anymore!