forked from MadhavBahl/iostream
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
792 lines (734 loc) · 39.3 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="description" content="A seminar on Java File Handling">
<meta name="author" content="Madhav Bahl">
<title>iostream</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
crossorigin="anonymous">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.1.0/css/all.css" integrity="sha384-lKuwvrZot6UHsBSfcMvOkWwlCMgc0TaWr+30HWe3a4ltaBwTZhyTEggF5tJv8tbt"
crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp"
crossorigin="anonymous">
<link rel="stylesheet" href="css/reveal.css">
<link rel="stylesheet" href="css/theme/league.css">
<!-- Theme used for syntax highlighting of code -->
<link rel="stylesheet" href="lib/css/zenburn.css">
<link rel="stylesheet" href="css/style.css">
<!-- Printing and PDF exports -->
<!-- <script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? 'css/print/pdf.css' : 'css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script> -->
</head>
<body>
<div class="reveal">
<div class="slides">
<section>
<h1>IOSTREAM</h1>
<p>#Java_File_Handling</p>
<div class="row">
<br>
<a style="padding: 20px;" target="_blank" href="https://github.com/CodeToExpress"><i class="fab fa-github"></i></a>
<a style="padding: 20px;" target="_blank" href="https://www.linkedin.com/company/codetoexpress/"><i
class="fab fa-linkedin-in"></i></a>
<a style="padding: 20px;" target="_blank" href="https://www.instagram.com/codetoexpress/"><i class="fab fa-instagram"></i></a>
<a style="padding: 20px;" target="_blank" href="http://codetoexpress.tech"><i class="fas fa-globe"></i></a>
<a style="padding: 20px;" target="_blank" href="https://medium.com/code-to-express"><i class="fab fa-medium"></i></a>
</div>
<br>
<!-- <p style="font-size: 0.7em;"><b>Code To Express Meetup #1</b></p> -->
<p style="font-size: 0.7em;">Find this presentation at: <a href="http://madhavbahl.tech/iostream/">http://madhavbahl.tech/iostream/</a></p>
<p style="font-size: 0.7em;">Use Arrow Keys To Control this Presentation</p>
</section>
<section>
<section>
<h3>About Me | The Lean Programmer</h3>
<div class="row">
<!-- <div class="col-xs-12 col-md-6 col-offset-md-6"> -->
<img height="300" width="307" style="background: rgba(0,0,0,0); border: none !important; box-shadow: 0;"
src="img/me.png" alt="" srcset="">
<!-- </div> -->
</div>
<p class="six">A cadet by nature and a developer by passion, a wannapreneur, tech enthusiast, open
source contributor (https://github.com/MadhavBahlMD), tech blogger
(https://medium.com/@madhavbahl10), writer, motivator and mentor for those who want to learn
programming, development and recent technologies.
Being an active part of many communities, also through his own tech community, CodeToExpress,
Madhav has been contributing to make the youth of this world well versed with programming. </p>
</section>
<section>
<h2>Yes, I am socially active :D</h2>
<p>Follow Me On <b>GitHub</b>: <a href="https://github.com/MadhavBahlMD">@MadhavBahlMD</a></p>
<p>Find Me On <b>Insta</b>: <a href="https://www.instagram.com/theleanprogrammer/">@theleanprogrammer</a></p>
<p>Read My Bolgs At <b>Medium</b>: <a href="medium.com/@madhavbahl10">@madhavbahl10</a></p>
<p>Connect With Me On <b>LinkedIn</b>: <a href="https://www.linkedin.com/in/madhavbahl/">@madhavbahl</a></p>
</section>
<section>
<h5>No more wasting time in introduction</h5>
<h2 style="letter-spacing: 2px;">Interested in knowing more about me?</h2>
<p>Visit <a href="http://madhavbahl.tech">http://madhavbahl.tech</a></p>
</section>
</section>
<section id="index">
<section>
<h3 style="">What are we going to discuss today? 💭</h3>
<ul style="list-style-type:none;" class="nine">
<a style="color:rgb(236, 236, 236);;" href="#prev">
<li>➳ Revision from previous class </li>
</a>
<a style="color:rgb(236, 236, 236);;" href="#whyFile">
<li>➳ Why File Handling? </li>
</a>
<a style="color:rgb(236, 236, 236);;" href="#excp">
<li>➳ Revisit Exceptions </li>
</a>
<a style="color:rgb(236, 236, 236);;" href="#io">
<li>➳ Introduction to IO</li>
</a>
<a style="color:rgb(236, 236, 236);;" href="#stream">
<li>➳ Intrduction to Streams</li>
</a>
<a style="color:rgb(236, 236, 236);;" href="#fout">
<li>➳ File Output Stream Class</li>
</a>
<a style="color:rgb(236, 236, 236);" href="#fin">
<li>➳ File Input Stream Class</li>
</a>
<a style="color:rgb(236, 236, 236);" href="#fwrite">
<li>➳ File Writer Class</li>
</a>
<a style="color:rgb(236, 236, 236);" href="#fread">
<li>➳ File Reader Class</li>
</a>
<a style="color:rgb(236, 236, 236);" href="#explore">
<li>➳ Explore More</li>
</a>
<a style="color:bisque;" href="#diy">
<li>➳ Small Project for you</li>
</a>
</ul>
</p>
<!-- <p class="six"><b>Disclaimer:</b> I have not invented any of the algorithm or problem solving
pattern that I am going to discuss, hence I own no rights on them, I am merely trying to spread
knowledge about problem solving</p> -->
</section>
</section>
<section id="prev">
<section>
<h1>Revision from previous class</h1>
<h2>The File Class</h2>
</section>
<section>
<h2>Constructors</h2>
<table class="seven">
<tr>
<th>Constructor</th>
<th>Description</th>
</tr>
<tr>
<td>File (String path)</td>
<td>Creates a new file. It gets file path in string</td>
</tr>
<tr>
<td>File (String Parent, String child)</td>
<td>Gets path of parent and name of child as arguments and creates new file</td>
</tr>
<tr>
<td>File (File Parent, String Child)</td>
<td>Gets object of a file whose path will be used as the location of child file, and the name of file as argument</td>
</tr>
</table>
</section>
<section>
<h3>Methods</h3>
<p>
<ul style="font-family:'Courier New', Courier, monospace;" class="eight">
<li>String getName()</li>
<li>String getParent()</li>
<li>String getPath()</li>
<li>String getAbsolutePath()</li>
<li>boolean canRead()</li>
<li>boolean canWrite()</li>
<li>boolean exists()</li>
<li>boolean isDirectory()</li>
<li>boolean isFile()</li>
<li>long length()</li>
<li>boolean renameTo()</li>
<li>And so on...</li>
</ul>
</p>
</section>
</section>
<section id="whyFile">
<section>
<h1>Why File Handling? 📚📁</h1>
</section>
<section>
<h3>There are tons of reasaons why we should learn file handling</h3>
<p>
<ul class="eight">
<li>Store Data</li>
<li>Use Files when there are no concurrent users</li>
<li>Use Files when security is not a concern</li>
<li>Access System Files</li>
<li>Create Scripts to automate various tasks</li>
<li>Automate the test cases</li>
<li>Basic CRUD operations when amount of data is small</li>
<li>Going for Database for small scale projects is not a good idea</li>
<li>Save state of your programs/Applications</li>
<li>By giving the ability of saving the state, one can apply a lot of creativity to make
innovative projects</li>
</ul>
</p>
<p class="seven"><b>Why did I focus on saving state?</b></p>
<p class="seven">Almost every application, game, etc. needs to remember the state where the user
left</p>
</section>
<section>
<h3>Some places where I used file handling</h3>
<p class="eight">
<ol class="eight">
<li>Data transfer from one platform to another (due to some constraints, making an API
wasn't possible)</li>
<li>Website Blocker - <a href="https://medium.freecodecamp.org/how-to-block-unproductive-websites-and-boost-your-productivity-using-javascript-20534011cccc">Project
Control Yourself</a> </li>
<li>Plagiarism Checker</li>
<li>File Converter</li>
<li>Automated testing in an open source project</li>
<li>Event Certificate and Mail</li>
</ol>
</p>
<p class="eight"><b>Have a project idea?</b> Let's do it together, mail me at
</section>
</section>
<section id="excp">
<section>
<h2>Before proceeding with the input output (IOSTREAM), It's important to know about Exception
Handling 🏃♂</h2>
</section>
<section>
<h2>Exception</h2>
<p class="nine">An event that occurs during the execution of a program that disrupts the normal
flow of program's instructions</p>
</section>
<section>
<h2>The 2 step master plan for handling exceptions </h2>
<p><b>The Brahmastra 🏹</b></p>
<p>
<ol>
<li>What went wrong?</li>
<li>What can we do about it?</li>
</ol>
</p>
</section>
<section>
<p class="eight">Two Types of Exception Handling Techniques</p>
<h1>LBYL vs EAFP</h1>
<p class="eight">Try to guess what they mean?</p>
</section>
<section>
<h2>LBYL</h2>
<p><b>Look Before You Leap</b></p>
<p class="eight">
<ul class="eight">
<li>Before proceeding with the processing, we check whether our conditions our fulfilled</li>
<li>Handle exceptions before they happen</li>
<li>Example, we check that the objecct is not null, and then use it</li>
<li>Example, we check the number is not zero before using it as a divisor</li>
</ul>
</p>
</section>
<section>
<h2>EAFP</h2>
<p><b>Easy to Ask for Forgiveness than Permission</b></p>
<p class="eight">
<ul class="eight">
<li>Go ahead and perform the task, and then respond to an exception</li>
</ul>
</p>
</section>
<section>
<script src="https://gist.github.com/MadhavBahlMD/1e46bede0b3c83526e977c036fc2b117.js"></script>
</section>
<section>
<script src="https://gist.github.com/MadhavBahlMD/521bc5fd82f00146f5dd3e2902a562b8.js"></script>
</section>
<section>
<h1>Your Homework 🙆♂</h1>
<p>Study more about LBYL and EAFP, and find out which one is better in what circumstances</p>
</section>
</section>
<section id="io">
<section>
<h1>What do you mean by Input and Output? ⌨🖥</h1>
</section>
<section>
<h2>INPUT</h2>
<p>A process of reading data from a source</p>
<p>That source can be anything, maybe a file, or even your keyboard</p>
</section>
<section>
<h2>OUTPUT</h2>
<p>A process of writing data to some destination</p>
<p>That destination might be the console, screen or a file</p>
</section>
<section>
<h2>Java IO and File Handling</h2>
<p>
<ul class="eight">
<li>Java uses the concept of streams to make IO operations fast</li>
<li>The package - java.io - contains all the classes required for IO operations</li>
</ul>
</p>
</section>
</section>
<section id="stream">
<section>
<h1>What do you mean by the term "STREAM" 🌊</h1>
</section>
<section>
<h2>Stream</h2>
<p class="seven">A stream (in english), means a sequential transfer of anything that can flow. And
it's the same in programming, a stream is nothing but the sequence of data (In java, it is
composed of bytes)</p>
<p class="eight"><b>3 types of streams provided to us in Java.io</b></p>
<p>
<ol class="eight">
<li><b>System.out</b>: Standard Output Stream</li>
<li><b>System.in</b>: Standard Input Stream </li>
<li><b>System.err</b>: Standard Error Stream</li>
</ol>
</p>
</section>
<section>
<h2>Example</h2>
<script src="https://gist.github.com/MadhavBahlMD/2fee99fbf05cb8165ad20ef9c614fdb4.js"></script>
</section>
<section>
<h3>Let's visualize the things</h3>
<img src="./img/javaio.png" style="height: 300px; background-color: rgba(0,0,0,0); border: 0;" alt="">
<p class="six">source: <a href="https://www.javatpoint.com/java-io">JavaTPoint</a></p>
</section>
<section>
<h3>Useful methods of OutputStream</h3>
<table class="seven">
<tr>
<th>Method</th>
<th>Description</th>
</tr>
<tr>
<td>1. public void write(int) throws IOException</td>
<td> is used to write a byte to the current output stream.</td>
</tr>
<tr>
<td>2. public void write(byte[]) throws IOException</td>
<td> is used to write an array of byte to the current output stream.</td>
</tr>
<tr>
<td>3. public void flush() throws IOException</td>
<td> flushes the current output stream.</td>
</tr>
<tr>
<td>4. public void close() throws IOException</td>
<td> is used to close the current output stream.</td>
</tr>
</table>
</section>
<section>
<h3>Useful methods of InputStream</h3>
<table class="seven">
<tr>
<th>Method</th>
<th>Description</th>
</tr>
<tr>
<td>1. int read() throws IOException</td>
<td> reads the next byte of data from the input stream. It returns -1 at the end of the
file.</td>
</tr>
<tr>
<td>2 int available() throws IOException</td>
<td>returns an estimate of the number of bytes that can be read from the current input
stream.</td>
</tr>
<tr>
<td>3. public void close() throws IOException</td>
<td> is used to close the current input stream.</td>
</tr>
</table>
</section>
</section>
<section>
<h3>File Handling: Simplified</h3>
<img style="background-color: rgba(0,0,0,0); border: 0; height: 400px;" src="./img/fh.png" alt="">
</section>
<section id="fout">
<section>
<p style="font-size: 68px;">What is the <span style="font-family:'Courier New', Courier, monospace;">FileOutputStream</span>
class in Java?</p>
</section>
<section>
<p>A simple output stream used to write primitive data types to the file</p>
<p class="six">Please note that if you need to write Strings and character oriented data, it is
preferred to use <span style="font-family:'Courier New', Courier, monospace">FileWriter</span>
class</p>
</section>
<section>
<p style="font-size: 68;"><span style="font-family:'Courier New', Courier, monospace;">FileOutputStream</span>
class methods</p>
<table class="seven">
<tr>
<th>Method</th>
<th>Description</th>
</tr>
<tr>
<td>protected void finalize()</td>
<td>It is used to clean up the connection with the file output stream.</td>
</tr>
<tr>
<td>void write(byte[] ary)</td>
<td>It is used to write <strong>ary.length</strong> bytes from the byte <a href="array-in-java">array</a>
to the file output stream.</td>
</tr>
<tr>
<td>void write(byte[] ary, int off, int len)</td>
<td>It is used to write <strong>len</strong> bytes from the byte array starting at offset
<strong>off</strong> to the file output stream.</td>
</tr>
<tr>
<td>void write(int b)</td>
<td>It is used to write the specified byte to the file output stream.</td>
</tr>
<tr>
<td>void close()</td>
<td>It is used to closes the file output stream.</td>
</tr>
</table>
</section>
<section>
<h3>Let's See an Example 💻</h3>
<script src="https://gist.github.com/MadhavBahlMD/001070d3279b4b823ac9813e74582988.js"></script>
</section>
<section>
<p class="seven">Can we write a string to file using <span style="font-family:'Courier New', Courier, monospace;">FileOutputStream</span>?</p>
<h2>Yes! Byte Array</h2>
<p class="seven"><b>Hint:</b><span style="font-family:'Courier New', Courier, monospace;">
str.getBytes();</span></p>
</section>
<section>
<script src="https://gist.github.com/MadhavBahlMD/1c532c8cb09770c83cf22aaabed692db.js"></script>
</section>
</section>
<section id="fin">
<section>
<p style="font-size: 68px;">What is the <span style="font-family:'Courier New', Courier, monospace;">FileInputStream</span>
class in Java?</p>
</section>
<section>
<p>Java FileInputStream class obtains input bytes from a file. It is used for reading byte-oriented
data (streams of raw bytes) </p>
<p class="six">Please note that if you need to read Strings and character oriented data, it is
preferred to use <span style="font-family:'Courier New', Courier, monospace">FileREader</span>
class</p>
</section>
<section>
<p style="font-size: 68;"><span style="font-family:'Courier New', Courier, monospace;">FileInputStream</span>
class methods</p>
<table class="six">
<tr>
<th>Method</th>
<th>Description</th>
</tr>
<tr>
<td>int available()</td>
<td>It is used to return the estimated number of bytes that can be read from the input
stream.</td>
</tr>
<tr>
<td>int read()</td>
<td>It is used to read the byte of data from the input stream.</td>
</tr>
<tr>
<td>int read(byte[] b)</td>
<td>It is used to read up to <strong>b.length</strong> bytes of data from the input stream.</td>
</tr>
<tr>
<td>int read(byte[] b, int off, int len)</td>
<td>It is used to read up to <strong>len</strong> bytes of data from the input stream.</td>
</tr>
<tr>
<td>long skip(long x)</td>
<td>It is used to skip over and discards x bytes of data from the input stream.</td>
</tr>
<tr>
<td>protected void finalize()</td>
<td>It is used to ensure that the close method is call when there is no more reference to
the file input stream.</td>
</tr>
<tr>
<td>void close()</td>
<td>It is used to closes the stream</td>
</tr>
</table>
</section>
<section>
<h2>Let's See an Example 💻</h2>
<script src="https://gist.github.com/MadhavBahlMD/812a0456945434c2d2c4765a3bf341ff.js"></script>
</section>
<section>
<h2>How would you read all character?</h2>
<p class="seven"><b>Hint:</b><span style="font-family:'Courier New', Courier, monospace;">
Use a while loop</span></p>
</section>
<section>
<script src="https://gist.github.com/MadhavBahlMD/4d493806ce003ace4a46cf67d9e1a7c7.js"></script>
</section>
</section>
<section id="fwrite">
<section>
<p style="font-size: 68px;">What is the <span style="font-family:'Courier New', Courier, monospace;">FileWriter</span>
class in Java?</p>
</section>
<section>
<p>Java FileWriter class is used to write character-oriented data to a file. It is character-oriented class which is used for file handling in java. </p>
<p class="six">Unlike <span style="font-family:'Courier New', Courier, monospace">FileOutputStream </span>
class, we don't need to convert string to byte array while writing</p>
</section>
<section>
<h2>Constructors</h2>
<table class="seven">
<tr>
<th>Constructor</th>
<th>Description</th>
</tr>
<tr>
<td>FileWriter(String file)</td>
<td>Creates a new file. It gets file name in string</td>
</tr>
<tr>
<td>FileWriter(File file)</td>
<td>Creates a new file. It gets file name in File object</td>
</tr>
</table>
</section>
<section>
<p style="font-size: 68;"><span style="font-family:'Courier New', Courier, monospace;">FileWriter</span>
class methods</p>
<table class="seven">
<tr>
<th>Method</th>
<th>Description</th>
</tr>
<tr>
<td>void write(String text)</td>
<td>It is used to write the string into FileWriter.</td>
</tr>
<tr>
<td>void write(char c)</td>
<td>It is used to write the char into FileWriter.</td>
</tr>
<tr>
<td>void write(char[] c)</td>
<td>It is used to write char array into FileWriter.</td>
</tr>
<tr>
<td>void flush()</td>
<td>It is used to flushes the data of FileWriter.</td>
</tr>
<tr>
<td>void close()</td>
<td>It is used to close the FileWriter.</td>
</tr>
</table>
</section>
<section>
<h2>Let's See an Example 💻</h2>
</section>
<section>
<script src="https://gist.github.com/MadhavBahlMD/9fdc313266b9475e53e1456ad64cccf3.js"></script>
</section>
</section>
<section id="fread">
<section>
<p style="font-size: 68px;">What is the <span style="font-family:'Courier New', Courier, monospace;">FileReader</span>
class in Java?</p>
</section>
<section>
<p>Yes, you gussed it right, Java FileReader class is used to read data from the file.</p>
</section>
<section>
<h2>Constructors</h2>
<table class="seven">
<tr>
<th>Constructor</th>
<th>Description</th>
</tr>
<tr>
<td>FileReader(String file)</td>
<td>It gets filename in string. It opens the given file in read mode. If file doesn't exist, it throws FileNotFoundException.</td>
</tr>
<tr>
<td>FileReader(File file)</td>
<td>It gets filename in file instance. It opens the given file in read mode. If file doesn't exist, it throws FileNotFoundException.</td>
</tr>
</table>
</section>
<section>
<p style="font-size: 88 !important;"><span style="font-family:'Courier New', Courier, monospace;">FileReader</span>
class methods</p>
<table class="seven">
<tr>
<th>Method</th>
<th>Description</th>
</tr>
<tr>
<td>int read()</td>
<td>It is used to return a character in ASCII form. It returns -1 at the end of file.</td>
</tr>
<tr>
<td>void close()</td>
<td>It is used to close the FileReader class.</td>
</tr>
</table>
</section>
<section>
<h2>Let's See an Example 💻</h2>
</section>
<section>
<script src="https://gist.github.com/MadhavBahlMD/0b7ea86d74ee3b5d6ceb5cce86480a18.js"></script>
</section>
</section>
<section id="explore">
<section>
<h1>NO! File handling isn't over yet</h1>
<p class="seven">What we discussed was a very small part in File Handling</p>
</section>
<section>
<h3>Tre Reading these topics after you go home/room/hostel 😬</h3>
<p class="seven">
<ul class="seven">
<li>Buffered Input/Output Stream</li>
<li>Sequence Input Stream</li>
<li>ByteArray Input/Output Stream</li>
<li>Data Input/Output Stream</li>
<li>FilterOutput Stream and FilterInput Stream</li>
<li>BufferedReader and BufferedWriter</li>
<li>CharArrayReader and CharArrayWriter</li>
<li>PrintStream</li>
<li>PrintWriter</li>
<li>StringReader and StringWriter</li>
<li>PipedReader and PipedWriter</li>
<li>Sequential Access and Random Access</li>
</ul>
</p>
</section>
</section>
<section id="diy">
<section>
<h3>Here's a small DIY Project for you 😃</h3>
<a href="https://medium.freecodecamp.org/how-to-block-unproductive-websites-and-boost-your-productivity-using-javascript-20534011cccc"> <img src="./img/prod.png" alt=""></a>
</section>
<section>
<h3>Create a simple time dependent website blocker in java</h3>
<p>A created a similar project using JavaScript, although the languages are different, the proceedure is similar</p>
<a href="https://medium.freecodecamp.org/how-to-block-unproductive-websites-and-boost-your-productivity-using-javascript-20534011cccc">https://medium.freecodecamp.org/how-to-block-unproductive-websites-and-boost-your-productivity-using-javascript-20534011cccc</a>
</section>
<section>
<p>Create a script to block the given set of websites on a particular time period each day</p>
<img src="./img/proj.gif" alt="">
</section>
</section>
<section>
<h2>Good Luck ✨</h2>
<h4>Be creative and apply file handling concepts more!</h4>
<p>To View This Presentation, Visit: <a href="http://madhavbahl.tech/iostream">http://madhavbahl.tech/iostream</a></p>
</section>
<!--
<section>
<h2>We Are Starting Some Open Source Projects</h2>
<p class="eight">Have a project idea? send your ideas at <a href="mailto:[email protected]?Subject=Project%20Idea" target="_top">[email protected]</a></p>
</section> -->
<section>
<section>
<h3>Want to improve your programming skills? 🤩</h3>
<p>Try out the daily codes challenge ✨</p>
<p><a href="https://github.com/CodeToExpress/dailycodebase">https://github.com/CodeToExpress/dailycodebase</a></p>
</section>
</section>
<section id="contact">
<h3>Have doubts? Feel free to reach out 😁</h3>
<!-- <p class="eight">Want us to conduct a meetup on a specific topic? or if you have some doubts, feel free
to contact </p> -->
<div id="contact">
<form method="POST" action="https://formspree.io/[email protected]">
<div class="row">
<div class="col-md-3"></div>
<div class="col-xs-12 col-md-6">
<input type="hidden" name="_subject" value="Contact request from personal website" />
<br>
</div>
</div>
<div class="row" style="margin-bottom: 25px !important;">
<div class="col-md-3"></div>
<div class="col-xs-12 col-md-6">
<input type="email" style="width: 100%;" name="_replyto" placeholder="Your email"
required>
</div>
</div>
<div class="row" style="margin-bottom: 10px !important;">
<div class="col-md-3"></div>
<div class="col-xs-12 col-md-6">
<textarea name="message" style="width: 100%; color: black;" name="_message" placeholder="Your message"
required></textarea>
</div>
</div>
<button type="submit" style="color: black;">Send</button>
</form>
</div>
</section>
<section id="thanks">
<h1>Thank You!</h1>
</section>
<section>
<h2>References</h2>
<p>
<ul class="eight">
<li><a href="https://www.javatpoint.com/java-io">JavaTPoint</a></li>
<li><a href="https://www.geeksforgeeks.org/file-handling-java-using-filewriter-filereader/">GeeksForGeeks</a></li>
<li><a href="https://www.tutorialspoint.com/java/java_files_io.htm">Tutorials Point</a></li>
</ul>
</p>
</section>
</div>
</div>
<script src="lib/js/head.min.js"></script>
<script src="js/reveal.js"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="https://code.jquery.com/jquery-2.2.4.js" integrity="sha256-iT6Q9iMJYuQiMWNd9lDyBUStIq/8PuOW33aOqmvFpqI="
crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
crossorigin="anonymous"></script>
<script>
// More info about config & dependencies:
// - https://github.com/hakimel/reveal.js#configuration
// - https://github.com/hakimel/reveal.js#dependencies
Reveal.initialize({
dependencies: [
{ src: 'plugin/markdown/marked.js' },
{ src: 'plugin/markdown/markdown.js' },
{ src: 'plugin/notes/notes.js', async: true },
{ src: 'plugin/highlight/highlight.js', async: true, callback: function () { hljs.initHighlightingOnLoad(); } }
]
});
</script>
</body>
</html>