Java IO And Networking

Parsa Hejabi

Table of Contents

  • IO
  • File Programming
  • Streams
  • Reader / Writer
  • Serialization
  • Socket Programming
  • RESTful API

Files

  • What is a File?
  • Why do we use Files?
  • How we use Files in our programs?
    1. Open
    2. Read/Write
    3. Close
  • Different kinds of Files?
    • Binary Files
    • Text Files

Different kinds of Files

  • Text Files:
    • Characters
    • .txt, .xml, .html, ...
  • Binary Files:
    • Bytes
    • .zip, .exe, .pdf, .docx, ...

Characters in Java

  • Unicode
  • Problems in ASCII.
  • The Unicode standard is a character set.
  • Characters are saved as numbers.
  • What is encoding?
  • UTF-8, UTF-16, UTF-32
    • The default for Java is UTF-16.

 
Streams...
 

  • What is a Stream?
    • Save or restore from a File.
    • Send data over a network to another program.
    • Communicate with devices like monitors, printers, ...
  • IO = Input / Output
  • Import java.io library to work with Files and Streams.

Streams...

Java IO and Networking

By Parsa Hejabi

Java IO and Networking

This slide was used to teach IO and Socket programming in Java for AP students of SBU CE faculty in December 2018.

  • 524