Commit 89fee36
committed
feat: implement file copy with uppercase-to-lowercase transformation using streams
Overview
Added SCIO1 program demonstrating Java file I/O using FileInputStream and FileOutputStream.
The program copies content from one file to another while converting uppercase letters to lowercase during the transfer.
Implementation Details
Input stream (FileInputStream): Reads bytes sequentially from the source file (Source1.txt). File must exist before execution.
Output stream (FileOutputStream): Writes processed bytes into the destination file (Source3.txt). If the file exists, it will be overwritten.
Processing logic:
- Data is read one byte at a time (fis.read()), returning -1 at EOF.
- Each byte is checked against the ASCII range 65–90 (uppercase A–Z).
- If the condition matches, 32 is added to the byte to convert it into the corresponding lowercase character.
- Otherwise, the original byte is written unchanged.
Resource management: Both input and output streams are explicitly closed to release system resources and avoid memory leaks.
Key Learning Points
Demonstrates low-level byte stream operations in Java.
Shows how to transform data while streaming from one file to another.
Reinforces understanding of ASCII-based character manipulation.
Highlights the importance of explicitly closing I/O streams.
Signed-off-by: https://github.com/Someshdiwan <[email protected]>1 parent 814cc72 commit 89fee36
File tree
3 files changed
+42
-8
lines changed- Section23JavaIOStreams/src
- MyJAVA
3 files changed
+42
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
8 | 10 | | |
9 | 11 | | |
10 | | - | |
| 12 | + | |
11 | 13 | | |
12 | | - | |
13 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
14 | 18 | | |
15 | 19 | | |
16 | 20 | | |
17 | 21 | | |
18 | | - | |
| 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 | + | |
0 commit comments