# shubhamrasal/11-packer_unpacker-java architecture

> Architecture diagram of the GitHub repository shubhamrasal/11-packer_unpacker-java, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shubhamrasal/11-packer_unpacker-java
- Repository: https://github.com/shubhamrasal/11-packer_unpacker-java

## Overview

##### Project type and purpose
- This is a standalone desktop Java application (using Swing for its GUI) whose sole responsibility is to pack multiple files into a single metadata-driven archive and to unpack that archive back into individual files.
- Presentation layer: Swing UI frames (login, packFrame, secondFrame, UnpackFrame)
- Processing layer: core file-packing logic (Packer.java, UnPacker.java)

##### File structure
- Top-level classes:
- login.java – entry point, handles user authentication
- packFrame.java, secondFrame.java, UnpackFrame.java – Swing windows for packing workflow, post-login navigation, and unpacking workflow
- ClockLabel.java – a GUI utility component (probably shows the current time)
- Packer.java – implements the pack operation (reads many files, writes a single metadata+data file)
- UnPacker.java – implements the unpack operation (reads the archive, reconstructs original files)
- No external configuration or deployment scripts are present; the application runs from the command line via `javac` / `java`.

##### README for insights
- Workflow:
1. Compile the entire project: `javac login.java`
2. Launch the UI: `java login`
3. User enters credentials (hard-coded “abcd/abcd”)
4. Access “Pack” or “Unpack” UIs to perform file operations
- The README confirms that metadata (file names, sizes, timestamps) is bundled with the binary data.

a. Main components
- Presentation Layer
- Login Window
- Packing Window
- Unpacking Window
- Utility Widget (ClockLabel)
- Processing Layer
- Packer Module
- UnPacker Module
- Storage
- Local File System (Input Directory, Output Directory, .pak Archive)
b. Relationships & Data Flow
1. User → Login Window
2. Login Window → Application Controller
3. Controller → either Packing Window or Unpacking Window
4. Packing Window → invokes Packer Module → writes PackedArchive(.pak) to File System
5. Unpacking Window → invokes UnPacker Module → reads PackedArchive(.pak) → recreates files on File System
c. Architectural patterns & principles
- Layered separation (UI vs core processing)
- Single responsibility classes (each Frame handles only its own UI flow; Packer/UnPacker focus solely on I/O logic)
- Simple MVC-style delegation: UI “Controllers” trigger business logic modules
d. Key technologies
- Java Swing (javax.swing.*) for all GUI components
- Java IO / NIO for file and stream handling
- Standard JDK—no external dependencies

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External User
    User((User)):::external

    %% Presentation Layer
    subgraph "Presentation Layer"
        LW["Login Window"]:::ui
        CL["Clock Widget Utility"]:::ui
        SF["Post-Login Navigation Window"]:::ui
        PF["Packing Window"]:::ui
        UF["Unpacking Window"]:::ui
    end

    %% Processing Layer
    subgraph "Processing Layer"
        PM["Packer Module"]:::processing
        UM["UnPacker Module"]:::processing
    end

    %% Storage
    FS[(Local File System)]:::storage

    %% Data Flows
    User -->|"enter credentials"| LW
    LW -->|"auth success"| SF
    SF -->|"open Pack UI"| PF
    SF -->|"open Unpack UI"| UF
    PF -->|"invoke pack(files)"| PM
    PM -->|"write archive.pak"| FS
    UF -->|"invoke unpack(archive)"| UM
    UM -->|"read archive.pak"| FS
    UM -->|"create files"| FS

    %% Utility relationships
    CL -.-> LW
    CL -.-> SF
    CL -.-> PF
    CL -.-> UF

    %% Click Events
    click LW "https://github.com/shubhamrasal/11-packer_unpacker-java/blob/master/login.java"
    click PF "https://github.com/shubhamrasal/11-packer_unpacker-java/blob/master/packFrame.java"
    click SF "https://github.com/shubhamrasal/11-packer_unpacker-java/blob/master/secondFrame.java"
    click UF "https://github.com/shubhamrasal/11-packer_unpacker-java/blob/master/UnpackFrame.java"
    click CL "https://github.com/shubhamrasal/11-packer_unpacker-java/blob/master/ClockLabel.java"
    click PM "https://github.com/shubhamrasal/11-packer_unpacker-java/blob/master/Packer.java"
    click UM "https://github.com/shubhamrasal/11-packer_unpacker-java/blob/master/UnPacker.java"
    click FS "https://github.com/shubhamrasal/11-packer_unpacker-java/blob/master/README.md"

    %% Styles
    classDef ui fill:#D0E1FF,stroke:#0366D6,color:#000;
    classDef processing fill:#DFFFD0,stroke:#228B22,color:#000;
    classDef storage fill:#E0E0E0,stroke:#999,color:#000;
    classDef external fill:#FFD0D0,stroke:#D60000,color:#000;
```
