Join David Gassner for an in-depth discussion in this video Scanning tokenized text, part of Advanced Java Programming.
One of the most common cases in reading files is tokenized text.…For example, comma delimited files where you get lines of text separated by commas,…spaces, tabs, or other characters.…Java has a class that handles this automatically called the scanner class.…I'll demonstrate this in a project called Scanning Text where I have two files: textfile.txt,…which has simple text with spaces between words, and tokenizedtext.txt, which uses commas…to separate the words.…
I'll start in this Main class, which has the same sort of code I've used previously, using…a BufferedReader and a BufferedWriter.…For this demo, I won't need the writer objects, I'm going to read the text one word at a time…and output it to the system console.…So, I'll delete the line that creates the writer, and I'll remove the import statements…that refer to the writer objects.…Now, within the Try clause, I'll create a new instance of the scanner class.…I'll data-type it a Scanner and call it s, and I will instantiate it with new Scanner.…
- 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.