Results 1 to 6 of 6
  1. #1
    Addez is offline Senior Member
    Join Date
    Aug 2009
    Posts
    294
    Rep Power
    0

    Default How do I open a file in its pure content?

    A computer is just 1/0s. Everyone knows that..
    But is there a method in java for opening any file (txt,exe,dll) so that It appears in a string full off 1 and 0 s?
    So Of a txt file containing Hello World, if I use that (the function im asking for) then It will return String "101011010101011101011010001101101010011011010 "
    Or something simular..

    Is there a way to do this?

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    13

    Default

    For what purposes?

    See the methods in FileInputStream

  3. #3
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    14

    Default

    Read it using an InputStream (not a Reader) byte for byte using Integer.toBinaryString on each byte.

  4. #4
    Addez is offline Senior Member
    Join Date
    Aug 2009
    Posts
    294
    Rep Power
    0

    Default

    Kay thnx =)
    Now I have (think so) successfully converted a txt file into pure bites which all lies in one single string..
    How do I get it back?
    Cause now I must reconvert that file so that the evil monkey in my closet doesn't beat me down again!
    Help me please!!
    I really ahve no clue what to do! And the monkey is outrageus!

  5. #5
    emceenugget is offline Senior Member
    Join Date
    Sep 2008
    Posts
    564
    Rep Power
    11

    Default

    you should really seek the answers on search engines. you're more looking for answers that lie in the api's than for solutions to actual problems.

  6. #6
    Addez is offline Senior Member
    Join Date
    Aug 2009
    Posts
    294
    Rep Power
    0

Similar Threads

  1. how to display content of .xls file in jsp
    By kirtichopra in forum Advanced Java
    Replies: 7
    Last Post: 09-15-2009, 04:07 PM
  2. how to read content of .xls file
    By kirtichopra2003 in forum Advanced Java
    Replies: 10
    Last Post: 09-11-2009, 01:03 PM
  3. Different Files Open in File -> Open Workspace
    By mgm2010 in forum JCreator
    Replies: 0
    Last Post: 04-11-2009, 02:14 PM
  4. How to Encrypt content of txt file?
    By aRTx in forum New To Java
    Replies: 0
    Last Post: 03-25-2009, 10:26 AM
  5. To open an image file such as Jpeg file using JAva Program
    By itmani2020 in forum Advanced Java
    Replies: 10
    Last Post: 07-11-2008, 09:57 AM

Posting Permissions

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