Join David Gassner for an in-depth discussion in this video Reading and writing character streams, part of Java Advanced Training.
- View Offline
- Exercise Files
In a previous video I described how to use the FileInputStream and FileOutputStream classes…to read and write both text and binary files.…But if you're working with character-based data, that is text files, it's recommended that…use classes named FileReader and FileWriter instead.…These classes--unlike the InputStream and OutputStream--automatically handle character sets other…than UTF-8. For this exercise I'll use the CharacterStreams project which has the same…code as in the previous video. It's reading and writing a couple of files.…
I'm going to start with a source file of "textfile txt" a file I've already placed in this project,…and I'll change the name of the output file to "newfile.txt".…Now I'll change the classes that I'm going to use to read and write.…The interfaces for these new classes are the same as for the old ones so all I have to…do is change the names of the classes that I'm using.…I'll change FileInputStream to FileReader, and I'll do that both in the data-type declaration…
- Installing Java on Windows and Mac OS X
- Installing Eclipse
- Using new features such as simplified generics
- Working with advanced class structures (member, local inner, etc.)
- Using the Reflection API
- Navigating inheritance trees
- Managing unordered and ordered sets
- Peeking and polling with queues
- Testing and error handling
- Managing files and directories
- Working with I/O streams
- Next steps with Java
Skill Level Advanced
1. Getting Started
2. Java 7 New Features
3. Using Advanced Class Structures
4. Using the Reflection API
5. More of the Collections Framework
6. Testing and Advanced Exception Handling
Using the finally keyword5m 40s
7. Managing Files and Directories in Java 7
8. Working with I/O Streams
9. Working with Multi-threading
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.