• Post Reply Bookmark Topic Watch Topic
  • New Topic

how jvm read byte by byte and character by character in i/o streams, readers

 
ravindar mynampati
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
good morning to all,

i would like to know how the jvm reads "hello world" text in a file when using stremas and readers in io package. how internally jvm takes for each character while reading from files in both byte streams and character streams.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 15715
73
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Ravindar, your question is a bit vague. What exactly do you want to know? The JVM just uses the services of the underlying operating system to read files.

Do you want to know how the JVM does the conversion from bytes to characters? That can be quite complicated. The Java type char holds Unicode characters, and conversion from bytes to characters is done via a character set. See the API documentation of the package java.nio.charset, which contains classes like Charset, CharsetDecoder and CharsetEncoder, which are classes that know how to convert bytes to and from Unicode characters.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!