java - Read structured binary file -
i want read binary file in java. know file contains succession of data structures as: ansi ascii byte string, integer, ansi ascii byte string. how can read , data of file, if suppose number of data structures known (n)? see interface datainput has method readutf() read string, uses utf-8 format. how can hanle case od ascii?
the flexible (and efficient) approach, think, is:
- open
fileinputstream
. - obtain
filechannel
using stream'sgetchannel()
method. - map channel
mappedbytebuffer
using channel'smap()
method. - access data through buffer's various
get*
methods.
Comments
Post a Comment