• 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

US-ASCII and File access

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone,


I have the following in my assignment:

1.

All numeric values are stored in the header information use the formats of the
DataInputStream and DataOutputStream classes.



2.

All text values, and all fields (which are text only), contain only 8 bit characters,
null terminated if less than the maximum length for the field.
The character encoding is 8 bit US ASCII.



so:

1. because US-ASCII is only 7 bit, i think that i should take the ISO-8859-1 or the UTF-8?
2. because DataInputStream extends InputStream , should i take for my database file obligative the DataInputStream
or the FileInputStream extends InputStream
or can i take RandomAccessFile too (RandomAccessFile implements DataInput and
DataInputStrem implements also DataInput)?
 
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I use RandomAccessFile and "ISO-8859-1" for my encoding.
 
Ranch Hand
Posts: 56
Python Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Radi Hadzhiyski wrote:1. because US-ASCII is only 7 bit, i think that i should take the ISO-8859-1 or the UTF-8?


I explicitly used the US-ASCII encoding. At work I'm a middleware developer and I have to be very picky (more than needed for this assignment) about codepages/charactersets/encodings...

Radi Hadzhiyski wrote:2. because DataInputStream extends InputStream , should i take for my database file obligative the DataInputStream
or the FileInputStream extends InputStream
or can i take RandomAccessFile too (RandomAccessFile implements DataInput and
DataInputStrem implements also DataInput)?


The formats named in the description matches the formats of the RandomAccessFile. You're safe to use the RAF.
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Radi,

Used the same things like Anne: RAF (think that every scjd'er is using that one) and ISO-8859-1 as character encoding.

Kind regards,
Roel
 
My favorite is a chocolate cupcake with white frosting and tiny ad sprinkles.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic