Assignment 6-A

File Processing Application

Build a file processing application with proper exception handling. Master file I/O operations, serialization, and the NIO API for efficient file management.

4-5 hours
Intermediate
125 Points
Submit Assignment
What You'll Practice
  • Handle exceptions properly
  • Read and write files
  • Implement serialization
  • Use NIO file operations
  • Create custom exceptions
Contents
01

Assignment Overview

Create a Log File Analyzer application that reads, processes, and writes log files while demonstrating proper exception handling and file I/O techniques.

Skills Applied: Exception Handling (6.1), File I/O (6.2), and NIO (6.3) from Module 6.
Exceptions

Try-catch, custom exceptions, try-with-resources

File I/O

Readers, writers, streams, serialization

NIO

Paths, Files, channels, buffers

02

Requirements

Part 1: Exception Handling Framework (30 points)

  • Create custom exceptions: FileProcessingException, InvalidLogFormatException
  • Implement proper exception hierarchy
  • Use try-with-resources for all file operations
  • Log all exceptions with appropriate messages

Part 2: Log File Reader (35 points)

  • Read log files using BufferedReader
  • Parse log entries (timestamp, level, message)
  • Filter logs by level (INFO, WARN, ERROR)
  • Handle malformed log entries gracefully

Part 3: Report Generation (30 points)

  • Generate summary reports in text format
  • Count occurrences by log level
  • Identify error patterns
  • Write reports using PrintWriter

Part 4: NIO Operations (30 points)

  • Use Files.readAllLines() for small files
  • Implement directory watching for new log files
  • Copy and backup processed files
  • Use Path and Files API throughout
03

Submission Guidelines

Folder Structure: Submit all files in a folder named assignment6_yourname
Required Files:
  1. exceptions/ - Custom exception classes
  2. LogEntry.java - Log entry model
  3. LogFileReader.java
  4. ReportGenerator.java
  5. FileWatcher.java
  6. Main.java
  7. sample_logs/ - Sample log files for testing
  8. README.txt
Ready to submit? Include sample log files for testing!
Submit Now
04

Grading Rubric

Criteria Points Description
Exception Handling 30 Custom exceptions and proper handling
Log File Reader 35 Parsing and filtering functionality
Report Generation 30 Accurate statistics and file output
NIO Operations 30 Proper use of NIO API
Total 125