Solved

Reading a file bit by bit

Posted on 2002-03-10
3
230 Views
Last Modified: 2010-03-31
I may be a bit ignorant but I'm assuming I could read and write any file bit by bit (ie. 1's and 0's).

Just to satisfy my own curiosity I would like to write a simple class that would take a filename, read it in and write 1's and 0's out to the screen and at the same time write this data to another file, essentially copying the file but also displaying it bit by bit.

I have done some reasearch into datainputstream which can return bytes but I would like to be able to see the bits?

Is this possible and is there a class that would do this for me?
0
Comment
Question by:unhappygilmore
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 4

Accepted Solution

by:
m_onkey_boy earned 75 total points
ID: 6855134
The byte is the smallest unit you can manipulate directly.  If you want to display the ones and zeros, you can read each byte and then use Integer.toBinaryString to get the binary representation of the bytes in String form.
0
 
LVL 9

Expert Comment

by:Venci75
ID: 7902056
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Answered by: m_onkey_boy
Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Venci75
EE Cleanup Volunteer
0
 
LVL 5

Expert Comment

by:Netminder
ID: 7962650
Per recommendation, force-accepted.

Netminder
EE Admin
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This video teaches viewers about errors in exception handling.
Suggested Courses

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question