Skip to content
This repository has been archived by the owner on Jan 4, 2020. It is now read-only.

Latest commit

 

History

History
63 lines (45 loc) · 3.27 KB

README.MD

File metadata and controls

63 lines (45 loc) · 3.27 KB

Some common null objects for Java

Build Status Coverage Status Dependency Status Maven Central Java SE 6 MIT License

Overview

This is a collection of null objects (i.e. implementations that do nothing) for the following use cases:

This library is hosted in the Maven Central Repository. You can use it with the following coordinates:

<dependency>
	<groupId>net.markenwerk</groupId>
	<artifactId>commons-nulls</artifactId>
	<version>1.0.4</version>
</dependency>

Consult the usage description and Javadoc for further information.

Usage

InputStream and OutputStream

This library provides NullInputStream as a null implementation of an InputStream and NullOutputStream as a null implementation of an OutputStream.

// an InputStream that yields no bytes
InputStream in = new NullInputStream();

// an OutputStream that drops all bytes
OutputStream in = new NullOutputStream();

Reader and Writer

This library provides NullReader as a null implementation of a Reader and NullWriter as a null implementation of a Writer.

// an InputStream that yields no characters
Reader in = new NullReader();

// an OutputStream that drops all characters
Writer in = new NullWriter();