Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 8 of 8

Thread: File Conversions Help

  1. #1
    Junior Member
    Join Date
    Nov 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default File Conversions Help

    Hello,

    I want to convert a file(txt,jpeg,mp3,wav) into binary file and process this binary file with a compression program which outputs a compressed file which contains the data to decode. This output file will be used by a decoder which will output a binary file.

    Now my question is how to convert this binary file into its respective Original format file ??
    How can we do it ??


  2. #2
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: File Conversions Help

    1. Welcome to Java Programming Forums.
    2. What have you tried so far?
    3. How are you actually converting the file to binary?
    Anyone who stops learning is old, whether at twenty or eighty. Anyone who keeps learning stays young. The greatest thing in life is to keep your mind young.

    - Henry Ford

  3. #3
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: File Conversions Help

    Every file contains bytes and can be considered binary. What do you mean by: "convert a file(txt,jpeg,mp3,wav) into binary file"? All files are already binary and can be read byte by byte.

    Can you explain what you mean by a "binary file"?
    If you don't understand my answer, don't ignore it, ask a question.

  4. #4
    Junior Member
    Join Date
    Nov 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: File Conversions Help

    Quote Originally Posted by Norm View Post
    Every file contains bytes and can be considered binary. What do you mean by: "convert a file(txt,jpeg,mp3,wav) into binary file"? All files are already binary and can be read byte by byte.

    Can you explain what you mean by a "binary file"?
    Converting into binary means I'm writing The same file in to 0's and 1's

  5. #5
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: File Conversions Help

    All files consist of bits with the values of 0 or 1?

    Do you mean you want a text file with the String values: "0" and "1"?
    With 8 characters for every byte in the original file?

    Can you explain why you want to make the file 8 times larger?
    If you don't understand my answer, don't ignore it, ask a question.

  6. #6
    Junior Member
    Join Date
    Nov 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: File Conversions Help

    my compression program accepts only the string values, what exactly i want to do is to convert a input file in to 0's and 1's and then i want to process that file containing 0's and 1's through one of my compression program which will give me another output file which is very small than the original file size. The problem I face is when i decode ie when i use the output file to get the 0's and 1's I'm not able to convert it back to the original file from that o's and 1's that are obtained.

  7. #7
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: File Conversions Help

    convert a input file in to 0's and 1's
    That will make the file 8 times larger since one byte will become 8 characters.

    problem I face is when i decode ie when i use the output file to get the 0's and 1's I'm not able to convert it back to the original file
    I suggest for working out the technique that you work with a short array of byte values. Convert them to "0"s and "1"s, and then convert the "0"s and "1"s back to the the byte array. Leave out the compression part for future testing.
    If you don't understand my answer, don't ignore it, ask a question.

  8. #8
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: File Conversions Help

    Quote Originally Posted by kyanamgoutham View Post
    my compression program accepts only the string values, what exactly i want to do is to convert a input file in to 0's and 1's and then i want to process that file containing 0's and 1's through one of my compression program which will give me another output file which is very small than the original file size. The problem I face is when i decode ie when i use the output file to get the 0's and 1's I'm not able to convert it back to the original file from that o's and 1's that are obtained.
    Why not? How are you trying to convert them back? Is there any special character after each byte?
    Anyone who stops learning is old, whether at twenty or eighty. Anyone who keeps learning stays young. The greatest thing in life is to keep your mind young.

    - Henry Ford

Similar Threads

  1. Conversions Between Celsius and Fahrenheit
    By baueml01 in forum What's Wrong With My Code?
    Replies: 6
    Last Post: October 9th, 2011, 07:49 PM
  2. Conversions of Numbers in Arrays
    By KiwiFlan in forum What's Wrong With My Code?
    Replies: 6
    Last Post: September 1st, 2010, 07:59 PM
  3. conversions and excel
    By mkslt4 in forum Java Theory & Questions
    Replies: 2
    Last Post: February 10th, 2010, 01:54 AM
  4. Java Variable Conversions
    By JavaPF in forum Java Programming Tutorials
    Replies: 2
    Last Post: June 23rd, 2009, 05:03 AM
  5. Java Variable Conversions
    By JavaPF in forum Java Code Snippets and Tutorials
    Replies: 2
    Last Post: June 23rd, 2009, 05:03 AM