0% found this document useful (0 votes)
122 views

Lab - Exp - 10 (Creating, Reading and Writing A File Using Input and Output Streams)

The document provides background information and instructions for a laboratory exercise on creating, reading, and writing files using input and output streams in Java. The exercise addresses applying knowledge of computing fundamentals and developing computer programs to automate real-life tasks. The experimental procedure involves writing an Integer object to a stream and reading it back, as well as encrypting a file by reading from one file and writing the encrypted text to another file. The exercise is evaluated based on criteria such as program execution, correct output, design, standards, and timely delivery.

Uploaded by

Richard Anolin
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
122 views

Lab - Exp - 10 (Creating, Reading and Writing A File Using Input and Output Streams)

The document provides background information and instructions for a laboratory exercise on creating, reading, and writing files using input and output streams in Java. The exercise addresses applying knowledge of computing fundamentals and developing computer programs to automate real-life tasks. The experimental procedure involves writing an Integer object to a stream and reading it back, as well as encrypting a file by reading from one file and writing the encrypted text to another file. The exercise is evaluated based on criteria such as program execution, correct output, design, standards, and timely delivery.

Uploaded by

Richard Anolin
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

COLLEGE OF COMPUTER STUDEIS

INFORMATION TECHNOLOGY DEPARTMENT

CCS0023L
(Object Oriented Programming)

EXERCISE

10
Creating, Reading and Writing a File Using Input and
Output Streams

Student Name / Group Richard R. Anolin II


Name:
Name Role
Members (if Group):

Section:
TX21
Doc Janice Abellana
Professor:
I. PROGRAM OUTCOME/S (PO) ADRESSED BY THE LABORATORY EXERCISE
a. Apply knowledge of computing appropriate to the discipline.

II. COURSE LEARNING OUTCOME/S (CLO) ADDDRESSED BY LABORATORY


EXERCISE
2 Apply knowledge of computing fundamentals and develop computer programs as a result of
evaluating possible alternative program constructs that will address the need for automating
real life tasks, taking into account the efficiency and effects of their choice of constraints.

III. INTENDED LEARNING OUTOME/S (ILO) ADDRESSES BY THE LABORATORY


EXERCISE
 Implement Input and Output stream in creating, reading and writing streams

IV. BACKGROUND INFORMATION

There are generally two types of streams, the character and byte streams. Let us just review the
basic difference between the two. Byte streams are file or device abstractions for binary data
while character streams are for Unicode characters.

The InputStream class is the abstract root class of all input byte streams whereas the
OutputStream class is the abstract root class of all output byte streams. For character streams, the
corresponding superclass of all classes are the Reader and the Writer class, respectively. Both
classes are abstract classes for reading and writing to character streams.

Streams are also categorized on whether they are used for reading or writing to streams.
Although it is already quite obvious, allow me to define these types of streams. You are allowed
to read from input streams but not write to them. On the other hand, you are allowed to write to
output streams but not read from them.
The InputStream class and the Reader class are the superclasses of all input streams.
The OutputStream class and the Writer class are the root classes of all output streams.

Input streams are also known as source streams since we get information from these
streams. Meanwhile, output streams are also called sink streams.

A node stream is a stream with the basic functionality of reading or writing from a specific
location such as a disk or from the network. Types of node streams include files, memory and
pipes. Filter streams, on the other hand, are layered onto node streams between threads or
processes to provide additional functionalities not found in the node stream by themselves.
Adding layers to a node stream is called stream chaining.
V. EXPERIMENTAL PROCEDURE:

1. Create a program that writes an Integer object to a stream and reads this object
from the stream.

2. Simple Encryption. Read from a file specified by the user and encrypt the content
of the file using a simple shifting technique. Also, ask the user to input the shift
size. Output the encrypted message to another file whose filename is also provided
by the user.

For example,
Shift size: 1
Message read from the file: Hello
Encrypted message: Ifmmp

1) Code:

Output:
2) Code:

Output:
VI. QUESTION AND ANSWER:

1. What is the difference between node and filter streams?


__Node is more like nodeJS while filter is a String function filtering out texts. Nodes contain the
basic functionality of reading or writing from a specific location while filter streams are layered
onto node streams between threads or processes.___

Note: The following rubrics/metrics will be used to grade students’ output in the lab
Exercise 10.

Program (100 pts.) (Excellent) (Good) (Fair) (Poor)


Program Program executes Program executes Program executes Program does not
execution (20pts) correctly with no with less than 3 with more than 3 execute (10-11pts)
syntax or runtime errors (15-17pts) errors (12-14pts)
errors (18-20pts)
Correct output Program displays Output has minor Output has Output is incorrect
(20pts) correct output errors (15-17pts) multiple errors (10-11pts)
with no errors (12-14pts)
(18-20pts)
Design of output Program displays Program displays Program does not Output is poorly
(10pts) more than minimally display the designed (5pts)
expected (10pts) expected output required output (6-
(8-9pts) 7pts)
Design of logic Program is Program has slight Program has Program is
(20pts) logically well logic errors that do significant logic incorrect (10-
designed (18- no significantly errors (3-5pts) 11pts)
20pts) affect the results
(15-17pts)
Standards Program code is Few inappropriate Several Program is poorly
(20pts) stylistically well design choices inappropriate written (10-11pts)
designed (18- (i.e. poor variable design choices
20pts) names, improper (i.e. poor variable
indentation) (15- names, improper
17pts) indentation) (12-
14pts)
Delivery The program was The program was The program was The program was
(10pts) delivered on time. delivered a day delivered two days delivered more
(10pts) after the deadline. after the deadline. than two days after
(8-9pts) (6-7pts) the deadline. (5pts)
Topic Input and Output Stream
Lab Activity No 10a
Lab Activity Writing Int Object in a File
CLO 2
Program execution (20)
Correct output (20)
Design of output (10)
Design of logic (20)
Standards (20)
Delivery (10)
TOTAL

Topic Input and Output Stream


Lab Activity No 10b
Lab Activity Simple Encryption
CLO 2
Program execution (20)
Correct output (20)
Design of output (10)
Design of logic (20)
Standards (20)
Delivery (10)
TOTAL

You might also like