com.anthonyeden.lib.io
Class NullWriter

java.lang.Object
  extended byjava.io.Writer
      extended bycom.anthonyeden.lib.io.NullWriter

public class NullWriter
extends java.io.Writer

A null writer will not write any data. This class includes a shared NullWriter instance which can be used throughout your application wherever a null writer is required.

Author:
Anthony Eden

Field Summary
static NullWriter NULL_WRITER
          Shared NullWriter instance.
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
NullWriter()
          Constructor.
 
Method Summary
 void close()
          Close the stream.
 void flush()
          Flush the data that is currently in the buffer.
 void write(char[] charArray)
          Write the given character array to the output stream.
 void write(char[] charArray, int offset, int length)
          Write the given character array to the output stream beginning from the given offset and proceeding to until the given length is reached.
 void write(int c)
          Write the given character to the output stream.
 void write(java.lang.String string)
          Write the given String to the output stream.
 void write(java.lang.String string, int offset, int length)
          Write the given String to the output stream beginning from the given offset and proceeding to until the given length is reached.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NULL_WRITER

public static final NullWriter NULL_WRITER
Shared NullWriter instance. You should be able to use this shared instance throughout your system wherever a null writer is required since the data is discarded.

Constructor Detail

NullWriter

public NullWriter()
Constructor.

Method Detail

close

public void close()
Close the stream.


flush

public void flush()
           throws java.io.IOException
Flush the data that is currently in the buffer.

Throws:
java.io.IOException

write

public void write(char[] charArray)
           throws java.io.IOException
Write the given character array to the output stream.

Parameters:
charArray - The character array
Throws:
java.io.IOException

write

public void write(char[] charArray,
                  int offset,
                  int length)
           throws java.io.IOException
Write the given character array to the output stream beginning from the given offset and proceeding to until the given length is reached.

Parameters:
charArray - The character array
offset - The start offset
length - The length to write
Throws:
java.io.IOException

write

public void write(int c)
           throws java.io.IOException
Write the given character to the output stream.

Parameters:
c - The character
Throws:
java.io.IOException

write

public void write(java.lang.String string)
           throws java.io.IOException
Write the given String to the output stream.

Parameters:
string - The String
Throws:
java.io.IOException

write

public void write(java.lang.String string,
                  int offset,
                  int length)
           throws java.io.IOException
Write the given String to the output stream beginning from the given offset and proceeding to until the given length is reached.

Parameters:
string - The String
offset - The start offset
length - The length to write
Throws:
java.io.IOException


Copyright (c) 2000-2003 Anthony Eden. All Rights Reserved.