CodeGym /Java Course /Java Core /Practice with InputStream/OutputStream

Practice with InputStream/OutputStream

Java Core
Level 8 , Lesson 5
Available

"Hello, Amigo! I almost forgot that you need to study. Here, train your processor."

5
Task
Java Core, level 8, lesson 5
Locked
Fix the bugs
Fix the functionality according to the requirements. The program should: 1. Write all the bytes from one file into another in one batch. 2. Close the IO streams. Hint: There are 4 bugs.
10
Task
Java Core, level 8, lesson 5
Locked
Counting commas
Read a file name from the console. Count the number of commas (',') in the file. Display the number. Close the streams. Hint: You need to compare with the ASCII code for ','.
20
Task
Java Core, level 8, lesson 5
Locked
Splitting a file
Read 3 file names from the console: file1, file2, file3. Split file1 as follows: Write the first half of its bytes to file2,and write the second half of its bytes to file3. If the number of bytes in file1 is odd, then file2 should contain the larger half. Close the streams.
10
Task
Java Core, level 8, lesson 5
Locked
Reversing a file
Read 2 file names from the console: file1, file2. Write all the bytes in file1 to file2, but in the reverse order. Close the streams.
10
Task
Java Core, level 8, lesson 5
Locked
DownloadException
1 Read file names from the console. 2 If the file is less than 1000 bytes, then: 2.1 Close the file stream. 2.2. Throw a DownloadException.
Comments (29)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
Daniel Ketcheson Level 28, Canada
25 November 2023
At some points this feels impossible. Sometimes I don't feel like I will ever fit in as a programmer. I don't have the focus to keep up with every task every day. I barely understand the lessons the first time. I have to talk to people close to me just to get back on my feet, which takes time to bring to the surface. But finding a solution that stems from my patience, understanding and style gives me a humble power. And that power is where I want to stem from. So keep beating me down. I'll thank you for it.
Hoist Level 35, San Diego, United States
17 September 2024
Suggest you built something ! -- over in Codegym Games or take a break and go to dot Net C# with the visual studio front end designer ... maybe android studio and build an App ...
Boat Level 40, Germany, Germany
28 April 2023
Hint: You need to compare with the ASCII code for ','. It's 44, to save you some time googling some terribly blurry tables
Tasmoda Level 28, Midrand, South Africa
28 July 2022
Great exercises.
Tomas Taubinger Level 47, Brno, Czech Republic
5 May 2022
With the second last task, you shouldn't write in description that streams must be closed, when you want the exact opposite for verification to go through. I deleted fileInputStream and fileOutputStream close() methods and it finally worked. EDIT: Same issue with the last task.
TheLordJackMC Level 39, Princeton, idk somewhere
18 July 2021
"train your processor" he says
Christ Desmedt Level 19, Gent
17 March 2021
task1808 needs tweaking, had a solution that did exactly what was required (ie split a file into 2 halves with the first half being largest by 1 in case of odd total bytes) and still got flagged for not outputting half and half
John Dangle Level 22, United States of America
15 November 2021
I agree. Ran into the same problem.
John Squirrels Level 41, San Francisco, Poland
16 November 2021
Please post your question in the section "Help" on our website. Our specialists as well the students, who already have solved this task, will give you a hint on how to manage the assignment.
Oliver Heintz Level 18, Mustang, United States
8 March 2021
I feel like I'm stumbling around in the dark on these, using brute force trial and error methods to pass validation.
Roman Grygorczuk Level 19, Cracow, Poland
16 March 2021
I'm trying to avoid that as it starts to be not doing by thinking but doing by guessing.
Oliver Heintz Level 18, Mustang, United States
1 April 2021
Well that's the thing. I feel like I know what I'm doing, but not what they're asking.
Chandan Thapa Level 22, Dubai, United Arab Emirates
28 December 2020
Like these exercises! :)
Biplob Level 22, কুমিল্লা, Bangladesh
29 May 2020
You're being pushed to complete tasks on the "Taming of InputStream and OutputStream in the wild". What does it mean ?
Cam Level 22, Austin, United States
10 May 2020
Hey CodeGym crew, Check out the Orcale java class hierarchy for IO objects. Everything (including BuffRead/Write, PrintWriter and such) comes from one of these four classes. And more broadly java.io. In reality it's pretty straight forward OOP stuff, but it took me forever to grasp haha Hope this helps! Hierarchy For Package java.io https://docs.oracle.com/javase/8/docs/api/java/io/package-tree.html ****OutputStream**** https://docs.oracle.com/javase/8/docs/api/java/io/OutputStream.html ****InputStream**** https://docs.oracle.com/javase/9/docs/api/java/io/InputStream.html ****Reader**** https://docs.oracle.com/javase/7/docs/api/java/io/Reader.html ****Writer**** https://docs.oracle.com/javase/7/docs/api/java/io/Writer.html