Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-15-2007, 02:13 AM
Member
 
Join Date: Nov 2007
Posts: 3
jkurth is on a distinguished road
reading a binary file with a RAF
I am working on a program where I am to access a binary file and read information from it, and use the info to perform different tasks. I know the file first has an index number of type long, and was told I must read the first 9 bits to see this. When I read in these bits and print them, it displays 000000050, which is what I want, the 50 part, but how do I actually make use of what I read in? Is there a good way to add each byte to a list and convert to an int?

Some of the data is not known as to how long the length or number of characters are in a string. The length is of type short. Is there a way to determine what the number bytes to read is?
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 12-15-2007, 03:44 AM
Member
 
Join Date: Nov 2007
Posts: 3
jkurth is on a distinguished road
I am able to read the file for the sets of data in which i know how far I need to go, where the index of 50 is a set long, so the readLong() method works fine, and the next 9 chars can be read with the readChar() method for the reference number of the actual data. The part I don't understand how to do is figure out how far to read for the next set of data which is the name of the data. The amount of characters to read is of type short, which is all I know. I heard of some method where java can determine the amount of characters to read, because it is in a block, however, I am unsure of this. hope this clears up what it is I am asking to do.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 12-20-2007, 08:30 AM
Member
 
Join Date: Dec 2007
Posts: 6
janakiram.attuluri is on a distinguished road
hi jkurth,

I am also working on similar kind of requirement. Can u pls post the code which u hav written.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading a Field in a Binary File janakiram.attuluri Advanced Java 2 01-09-2008 11:47 AM
Reading a file mew New To Java 2 12-30-2007 01:23 PM
Reading Binary File and Changing data janakiram.attuluri Advanced Java 1 12-21-2007 11:10 AM
How to load binary content of a .class file boy22 Advanced Java 1 08-03-2007 07:21 PM
Reading from a file leebee New To Java 1 07-23-2007 01:02 PM


All times are GMT +3. The time now is 08:26 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org