DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
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

Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links