• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Convert a String to a Byte Stream

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have converted a file to a string representation. I need to parse it based on byte positions. Such as the first 200 Bytes and then from Byte 450 to 500 etc

How do i do this?
 
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Seems to me like it would be more appropriate to use a FileInputStream to read a desired number of bytes from the file, process those bytes accordingly and continu that process of reading/processing until the end of the file is reached or all relevant bytes have been processed. Anyway, if that is somehow not an option you could use String#getBytes() to fill a ByteArrayInputStream, I guess.
reply
    Bookmark Topic Watch Topic
  • New Topic