Skip to content

TmpFolder

Jordan Samhi edited this page Aug 22, 2023 · 1 revision

TmpFolder 📁

TmpFolder is a class designed to provide a singleton instance of a temporary folder utility. It allows obtaining the path to the default temporary directory for the current system.

Table of Contents

Overview

The TmpFolder class provides a straightforward way to access the default temporary directory on the current system. It implements the Singleton pattern, ensuring that only one instance of the class can be created.

Methods

v() -> TmpFolder

Static method that returns the singleton instance of TmpFolder. If no instance exists, a new one is created.

get() -> String

Gets the default temporary directory for the current system, returning the path as a string.

Examples

Example 1: Getting the Singleton Instance of TmpFolder

TmpFolder tmpFolder = TmpFolder.v(); // Obtains the singleton instance

Example 2: Getting the Path to the Default Temporary Directory

TmpFolder tmpFolder = TmpFolder.v();
String tmpDirPath = tmpFolder.get(); // Gets the path to the default temporary directory
System.out.println("Temporary Directory Path: " + tmpDirPath);

These examples illustrate how to utilize the TmpFolder class to access the default temporary directory for the current system. By implementing the Singleton pattern, it ensures consistent access to this resource across different parts of an application.

Clone this wiki locally