Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Class notes

Java OOP

Rating
-
Sold
-
Pages
121
Uploaded on
09-05-2022
Written in
2021/2022

Java OOP concepts Polymorphism Inheritence Methods Class Object Files and File writing Read and Writing of Files OOP

Institution
Course

Content preview

Java I/O

,Java IO and NIO
• Java allows to manage IO in two different ways
• IO
• NEW/NON Blocking IO



IO NIO
Stream oriented Buffer oriente
Blocking IO Non blocking I
Selectors

,Stream Oriented vs. Buffer Oriented

• The first big difference between Java NIO and IO is that IO is stre
oriented, where NIO is buffer oriented. So, what does that mean
• Java IO being stream oriented means that you read one or more
time, from a stream. What you do with the read bytes is up to y
are not cached anywhere. Furthermore, you cannot move forth
in the data in a stream. If you need to move forth and back in th
read from a stream, you will need to cache it in a buffer first.
• Java NIO's buffer oriented approach is slightly different. Data is
buffer from which it is later processed. You can move forth and
buffer as you need to. This gives you a bit more flexibility during
processing. However, you also need to check if the buffer contai
data you need in order to fully process it. And, you need to mak
when reading more data into the buffer, you do not overwrite d
buffer you have not yet processed.

, Blocking vs. Non-blocking IO
• Java IO's various streams are blocking. That means, that when a thread
a read() or write(), that thread is blocked until there is some data to rea
data is fully written. The thread can do nothing else in the meantime.
• Java NIO's non-blocking mode enables a thread to request reading data
channel, and only get what is currently available, or nothing at all, if no
currently available. Rather than remain blocked until data becomes ava
reading, the thread can go on with something else.
• The same is true for non-blocking writing. A thread can request that so
written to a channel, but not wait for it to be fully written. The thread c
on and do something else in the mean time.
• What threads spend their idle time on when not blocked in IO calls, is u
performing IO on other channels in the meantime. That is, a single thre
manage multiple channels of input and output.

Connected book

Written for

Institution
Course

Document information

Uploaded on
May 9, 2022
Number of pages
121
Written in
2021/2022
Type
Class notes
Professor(s)
Salvatore distefano
Contains
All classes

Subjects

$8.99
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
theibman

Get to know the seller

Seller avatar
theibman University of Messina
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
4 year
Number of followers
0
Documents
3
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions