piątek, 28 grudnia 2012

Java IO interview questions

  1. What is Java Streams
    • Briefly: Java IO streams are flows of data you can either read from, or write to.  Streams are typically connected to a data source or data destination like a file, network connection. In Java streams are typically byte based. When you have to write component that needs to read input from a stream you can use InputStream (or one of its subclasses e.g. FileInputStream). Whereas when you have to write component that needs to write output to a stream you can use OutputStream (or one of its subclasses e.g. FileOutputStream). 
    • I had the opportunity to use Java IO streams in small projects during my studies, when I had to read/write not large amount of data. But recently at work I have implemented solution consisted of saving all the data coming from trading system to a file. That data related to the current date only. I have tested solution based on the use of Java IO Streams and Java NIO Buffers and I have found that Java NIO Buffers can do the same job up to ten times faster.  
  2. What is Reader and Writer in Java IO
    • Briefly: Java IO's readers and writers work much like InputStrem and OutputStream with the exception that Readers and Writers are characted based. They are intended for reading and writing text. 
    • I used Readers and Writers only in small projects during my studies. 
  3. Which of them is byte base and which is char based
    • Streams are byte based whereas Readers and Writers are char based
  4. NIO and IO
  5. Reading and writing text file in Java
  6. Creating file and Directory in Java
  7. Memory Mapped File in Java

Brak komentarzy:

Prześlij komentarz