Solved

Reading a file bit by bit

Posted on 2002-03-10
3
221 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
tomcat startup error 5 134
Unhandled exception type Exception 18 52
eclipse console opening separately 2 35
java mysql insert application 14 41
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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 tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

740 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