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.
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.
hm.. makes sense. I'll check that out later toda. Thanx
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