×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Super Contributor
    Join Date
    Mar 2003
    Posts
    2,426

    Hexidecimal picture messages

    Is there a program that can convert images (gif or wbmp) to hexidecimal, can nokia toolkit do it? and how is it then sent to the handset? thanks, sam.

    Posted by Sam Childs, childsdesign@hotmail.com
    on February 12, 2002 at 12:56

  2. #2
    Super Contributor
    Join Date
    Mar 2003
    Posts
    2,426

    RE: Hexidecimal picture messages

    Posted by balaji iyer, balaji_v_iyer@yahoo.com
    on February 13, 2002 at 13:18

    Hi Sam,

    Try to compile the following code in java which takes an input file and creates the hexofile of it:
    PS: Could you answer to a question that I have posted on Feb 13 here.

    Thanks
    Balaji

    import java.io.*;

    public class FileToHex
    {

    public static void main (String[] args)
    {

    String directory = args[0];

    File dir = new File(directory);

    File[] files = dir.listFiles();
    for (int fileCount = 0 ; fileCount < files.length ; fileCount++)
    {

    if (files[fileCount].isDirectory() == false)
    {
    System.out.println("Hex Encoding: " + files[fileCount]);
    String hexByte = "";
    String hexTotal = "";

    try
    {
    RandomAccessFile inputfile = new RandomAccessFile(files[fileCount], "r"
    FileOutputStream outputfile = new FileOutputStream(files[fileCount] + ".hex", true);
    PrintStream out = new PrintStream(outputfile);

    for (int i = 1 ; i <= inputfile.length() ; i++)
    {
    hexByte = Integer.toHexString(inputfile.read()).toUpperCase();

    if (hexByte.length() == 1)
    hexByte = "0" + hexByte;

    hexTotal = hexTotal + hexByte;
    }

    out.println(hexTotal);

    out.flush();
    out.close();
    outputfile.close();
    inputfile.close();

    }
    catch (FileNotFoundException fnfe)
    {
    System.out.println(fnfe);
    }
    catch (IOException ioe)
    {
    System.out.println(ioe);
    }
    }

    }




    }

    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •