So let's just look at byte streams byte streams are used when we want to build with ROBERTS That is 2
we want to read Robert serially or we want to write crossbench serially characters dreams which we will 3
see later are also built on top off by extremes. 4
We already saw that input stream an output stream process some of us based classes for our byte oriented 5
streams. 6
And this lesson will focus on these two classes. 7
And let's just look at the input stream class. 8
It is a bit abstract class for on byte oriented input streams. 9
So it is an abstract class and it is used to read data in groups of eight big bytes. 10
And here's one method for reading exactly one byte at a time. 11
It is an abstract matter which means that the implementation will be provided by subprocess. 12
This method reached exactly one byte and returns the corresponding engrain knew which would be between 13
0 and 235 that is in between zero and hoodooed up out of eight. 14
Minus one under-graduate and minus one if and off nostri is detected that is there is no more datagrid 15
for example for character 8. 16
This method would return the corresponding decimal equal and 97. 17
Note that the method would throw an exception if there is any issue while performing the real operation 18
. 19
Here is an adult version of the read method which is used to read groups of bytes. 20
That is it can be more than one byte. 21
But this method unlike the previous version is a concrete method and it has three parameters a binary 22
undo in parameters offset and length. 23
So a byte array is passed us input with this method and the method will read up to relent number of 24
bytes from the input stream into the input array starting from the index position offset if the number 25
of bytes that can be read is less than that then only those boats are correct. 26
The method returns a total number of bytes read or it would read and minus one if and roughly misdirected 27
and dentally it repeatedly in Worcester read method. 28
Which means that the read method of a subclass is invoked as the read method in the input stream. 29
Class is abstract. 30
And here is another Read matter. 31
This one takes only byte arrays in order and it simply invokes the previous version of the read method 32
by passing the input byte array along with zero as value for offset and the input arest Lent as value 33
for Lent barometer. 34
So in looking this method would fill the array completely starting from index position zero nada. 35
That all recalls woodblock when no data is available. 36
In other words when no data is available the method will wait until the data becomes available. 37
One example would be when we are reading it up for remanent work. 38
On the other end of the network is not sending data. 39
In this case the method simply blocks non-rhetorical look at the output stream. 40
Plus it is the biz abstract class for all byte oriented output streams. 41
So it is an abstract class like the input stream and it is used to write data in groups of 8 bit bites 42
. 43
And here is a method for writing one byte at a time to the output stream. 44
Here the input parameter is an end which we know has 32 bits but this method needs to write only one 45
byte. 46
So it writes the least significant byte that is that 8 lower order bits which come on the rightmost 47
end and the remaining one before that come on the left are discarded. 48
No similar to read here is the second motion of light mattered. 49
And it is also a concrete method and it is used to write groups of bytes of the content rate write is 50
stored in the input at it. 51
So the method will write length number of bytes from the input array starting at an exposition offset 52
like the read method internally. 53
This method repeatedly invokes the right method. 54
That is the right method of a subclass will be invoked as write method in this class is abstract like 55
in the case of read. 56
Here is the third motion of the right better. 57
We know that it simply invokes the previous right method by passing the input by the array along with 58
zero as a value for offset and input at its length as value for Lent parameter. 59
So those are the read and write operations does not have some subclasses provide more efficient implementations 60
. 61
What are these methods. 62
Here is the input stream hierarchy with some of the commonly used classes live. 63
Let's explore some of these classes. 64
The first one to look at will be file input stream on file output stream classes. 65
And here is the output stream hierarchy as you can see it is pretty identical to the input stream hierarchy 66
. 67
As for every input stream class we also have an output stream class only. 68
Here is the print string class. 69
So that's about it. 70
And we mainly look at the bits abstract classes input stream an output stream. 71
Thank you.