001package org.unix4j.io; 002 003import org.unix4j.line.Line; 004 005/** 006 * Input device representing an empty set with no lines. 007 */ 008public class NullInput extends AbstractInput { 009 010 public static final NullInput INSTANCE = new NullInput(); 011 012 @Override 013 public boolean hasMoreLines() { 014 return false; 015 } 016 017 @Override 018 public Line readLine() { 019 return null; 020 } 021 022 /** 023 * Performs a no-op as there are no underlying resources 024 */ 025 @Override 026 public void close() { 027 //nothing to do 028 } 029 030 @Override 031 public String toString() { 032 return "/dev/null"; 033 } 034}