This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes converting from binary to ascii Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "converting from binary to ascii" Watch "converting from binary to ascii" New topic
Author

converting from binary to ascii

Barry Brashear
Ranch Hand

Joined: Jun 05, 2001
Posts: 303
Does anyone know of an algorithm to convert a .pcx file, which is a binary
file, to ascii?

Thanks.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41052
    
  43
Anything binary can be converted (reversibly) to ASCII by the Base64 encoding. One of the libraries that implements it is Jakarta Commons Codec. Understand, though, that no image-specific operations can be performed on that ASCII representation until it is decoded back to binary.
[ January 04, 2007: Message edited by: Ulf Dittmer ]

Ping & DNS - my free Android networking tools app
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
can try apaches commons codec package.


Rahul Bhattacharjee
LinkedIn - Blog
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18505
    
  40

Base64 encoding (and decoding) is actually built into the JVM core classes -- via the sun.misc.BASE64Encoder and sun.misc.BASE64Decoder classes.

Interestingly, these classes have come into "common" usage to the point that they are also built into the IBM JVM as well. (with the same package and class names)

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Lucas Lee
Ranch Hand

Joined: Oct 02, 2006
Posts: 53
Use Base64 or other similar encoding algorithm.
But you need pay attention to that encoding will enlarge the file size to 1.33 times.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: converting from binary to ascii
 
Similar Threads
Reading image and convert it to Base64 format
pdf getting corrupted while transfering through FTP
Checking if a file is binary/ascii in Java
Binary to Ascii converter in Java?
FTP upload