SE-1021 Software Engineering II Week 9, Class 3 Get ready for PollEverywhere! BlocksMania and File...

12
SE-1021 Software Engineering II Week 9, Class 3 Get ready for PollEverywhere! BlocksMania and File I/O Reading/Writing text in ASCII, Unicode, and UTF-8 Reading/Writing binary data Handy tool for finding files 1

Transcript of SE-1021 Software Engineering II Week 9, Class 3 Get ready for PollEverywhere! BlocksMania and File...

Page 1: SE-1021 Software Engineering II Week 9, Class 3 Get ready for PollEverywhere! BlocksMania and File I/O Reading/Writing text in ASCII, Unicode, and UTF-8.

SE-1021Software Engineering II

Week 9, Class 3 Get ready for PollEverywhere! BlocksMania and File I/O

Reading/Writing text in ASCII, Unicode, and UTF-8 Reading/Writing binary data Handy tool for finding files

1

Page 2: SE-1021 Software Engineering II Week 9, Class 3 Get ready for PollEverywhere! BlocksMania and File I/O Reading/Writing text in ASCII, Unicode, and UTF-8.

HW

See hw/ on web https://faculty-web.msoe.edu/yoder/se1021/h

w/

SE-1021Dr. Josiah Yoder

Slide style: Dr. Hornick2

Page 3: SE-1021 Software Engineering II Week 9, Class 3 Get ready for PollEverywhere! BlocksMania and File I/O Reading/Writing text in ASCII, Unicode, and UTF-8.

PollEverywhere Responses

PollEverywhere responses for the last lecture are available at slides/se1021-9-1-pollEverywhereResponses Shows what I see for non-anonymous questions

SE-1021Dr. Josiah Yoder

Slide style: Dr. Hornick3

Page 4: SE-1021 Software Engineering II Week 9, Class 3 Get ready for PollEverywhere! BlocksMania and File I/O Reading/Writing text in ASCII, Unicode, and UTF-8.

Useful Resources

JOptionPane advanced features Dean & Dean, pp. 784-787

JFileChooser (D&D, pp. 748-753) JDialog

For creating a more advanced “JOptionPane” (e.g. with multiple fields)

javax.swing.Timer For having regularly-repeating events (or other

timed events)SE-1021

Dr. Josiah YoderSlide style: Dr. Hornick

4

Page 5: SE-1021 Software Engineering II Week 9, Class 3 Get ready for PollEverywhere! BlocksMania and File I/O Reading/Writing text in ASCII, Unicode, and UTF-8.

Editing binary files

Check out Be.HexEdit

SE-1021Dr. Josiah Yoder

Slide style: Dr. Hornick5

Page 6: SE-1021 Software Engineering II Week 9, Class 3 Get ready for PollEverywhere! BlocksMania and File I/O Reading/Writing text in ASCII, Unicode, and UTF-8.

File I/O (1)

Low-level file I/O for raw byte I/O, similar to System.in.read() and System.out.write() FileInputStream — reads raw bytes FileOutputStream — writes raw bytes

Text file I/O for I/O of text Scanner - reads & parses text (provides readLine) PrintWriter - writes text

Text file I/O (alternate, perhaps more complicated) BufferedReader - Provides readLine

6

Page 7: SE-1021 Software Engineering II Week 9, Class 3 Get ready for PollEverywhere! BlocksMania and File I/O Reading/Writing text in ASCII, Unicode, and UTF-8.

File I/O (2)

High-level file I/O for I/O of primitive data types DataInputStream — reads primitive data types DataOutputStream — writes primitive data types

Object file I/O for I/O of arbitrary object data ObjectInputStream — reads arbitrary object data ObjectOutputStream — writes arbitrary object

data

SE-1021Dr. Josiah Yoder

Slide style: Dr. Hornick7

Page 8: SE-1021 Software Engineering II Week 9, Class 3 Get ready for PollEverywhere! BlocksMania and File I/O Reading/Writing text in ASCII, Unicode, and UTF-8.

SE-2811Dr. Josiah Yoder

Slide style: Dr. Hornick8

Page 9: SE-1021 Software Engineering II Week 9, Class 3 Get ready for PollEverywhere! BlocksMania and File I/O Reading/Writing text in ASCII, Unicode, and UTF-8.

BlocksMania load-level

GameBoard class (See example)

Simple tile class

SE-1021Dr. Josiah Yoder

Slide style: Dr. Hornick9

Page 10: SE-1021 Software Engineering II Week 9, Class 3 Get ready for PollEverywhere! BlocksMania and File I/O Reading/Writing text in ASCII, Unicode, and UTF-8.

BlocksMania Tile

SE-1021Dr. Josiah Yoder

Slide style: Dr. Hornick10

[TODO: How to prep this question?] Since the type will be the same for every

object from the Tile class, can you think of a better way to store this information?

Page 11: SE-1021 Software Engineering II Week 9, Class 3 Get ready for PollEverywhere! BlocksMania and File I/O Reading/Writing text in ASCII, Unicode, and UTF-8.

Consider this code:

for(int col = 0; col<numCols && col<line.length()+1; col++) {

c = line.charAt(col+1);

}

How can we fix this to skip the first character, and have col line up with the column headers?

SE-2811Dr. Josiah Yoder

Slide style: Dr. Hornick11

Page 12: SE-1021 Software Engineering II Week 9, Class 3 Get ready for PollEverywhere! BlocksMania and File I/O Reading/Writing text in ASCII, Unicode, and UTF-8.

SE-2811Dr. Josiah Yoder

Slide style: Dr. Hornick12

DO ONLINE:PollEv.com/yoderj