• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

How to read .eips file in Java ?

 
Rancher
Posts: 5035
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

i want to read a value from that record


What format is that value in? Where is the first  byte of the value and how many bytes does use.

Note: The variable named: recLength  should be given a name that describes what it holds.  It looks like the variable named: size holds the record's length. A better name might be theRecord or buffer.

I suggest that you write a small testing program to work out the classes and methods for extracting data from an array of bytes.  Here are some useful tools:
System.out.println("an ID "+ java.util.Arrays.toString(theArrayName)); // display the contents of an array
ByteArrayOutputStream - use this to write some test data into a byte array for testing the code to read from the array
ByteArrayInputStream - use to create an InputStream from a byte array.  That InputStream can be used with higher level classes to access the data in the bytes.  
 
Sheriff
Posts: 28323
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Well, this is kind of the hard way to do it. A lot easier to write and (more important) easier to read:



And for other parts of the record you should find out about the substring() method of the String class.

And by the way "recLength" isn't a good name for the data in the record, in my opinion. It sounds more like the length of the record than the record itself. I would have called it "record" or something like that.
 
The moustache of a titan! The ad of a flea:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic