File -> Binary


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: File -> Binary

  1. #1
    Join Date
    Mar 2005
    Posts
    24

    File -> Binary

    I was playing around with XOR encryption, (not for practical use, just playing with it) and I was wondering if there was a reasonable way to access the binary code of a file in Java. I realize for a text file I could use a char array and get the ascii value, convert to base 2, yada yada.. but I was hoping there was a better way for a wider variety of file types.

    Thanx

  2. #2
    Join Date
    Mar 2005
    Posts
    24
    anyone ?

  3. #3
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    1,560
    Can't you open it as a FileInputStream, check its available noOf bytes,
    make yourself a byte array of that size and read the file into that array ?
    Last edited by sjalle; 03-15-2005 at 07:10 AM.
    eschew obfuscation

  4. #4
    Join Date
    Mar 2005
    Posts
    24
    hm.. makes sense. I'll check that out later toda. Thanx

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center