This week's book giveaway is in the Design and Architecture forum.
We're giving away four copies of Communication Patterns: A Guide for Developers and Architects and have Jacqui Read on-line!
See this thread for details.
  • 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

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
 
It's hard to fight evil. The little things, like a nice sandwich, really helps. Right tiny ad?
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic