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