Skip to content

Java file I/O lab exercises covering byte streams, character streams, and buffered I/O for OOC2

License

Notifications You must be signed in to change notification settings

danielcregg/ooc2-io

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OOC2 I/O Labs

Java License: MIT

Java file I/O lab exercises for the Object-Oriented Computing 2 (OOC2) module. These examples demonstrate reading from and writing to files using byte streams, character streams, and buffered I/O.

Overview

This repository contains a collection of Java programs that illustrate core file I/O concepts from the java.io package. Each class focuses on a different aspect of file handling, from low-level byte-at-a-time copying to buffered readers, Scanner-based parsing, and formatted output. Sample resource files are included so that every example can be compiled and run immediately.

Features

  • Byte stream copying with FileInputStream and FileOutputStream, including ASCII visualization
  • Character stream copying using FileReader and FileWriter
  • Buffered I/O with BufferedReader for efficient line-by-line reading
  • Scanner-based file parsing to read integers and compute averages from a file
  • Formatted file output using java.util.Formatter
  • Exception handling patterns with try-catch-finally for resource management
  • Sample resource files including text files, CSV data, and serialized objects

Prerequisites

  • Java Development Kit (JDK) 8 or later
  • A Java IDE (Eclipse, IntelliJ IDEA, or VS Code) or the command-line javac compiler

Getting Started

Installation

git clone https://github.com/danielcregg/ooc2-io.git
cd ooc2-io

Usage

Compile and run any example from the project root:

javac -d bin src/ie/gmit/ooc2labs/io/CopyFileByte.java
java -cp bin ie.gmit.ooc2labs.io.CopyFileByte

The programs read from and write to the resources/ directory, which contains all required input files.

Tech Stack

Technology Purpose
Java 8 Core programming language and I/O APIs
java.io File streams, readers, writers, and buffered I/O
java.util.Scanner File parsing and tokenization

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

Java file I/O lab exercises covering byte streams, character streams, and buffered I/O for OOC2

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages