org.geotools.io
Class NumberedLineWriter

java.lang.Object
  extended byjava.io.Writer
      extended byjava.io.FilterWriter
          extended byorg.geotools.io.NumberedLineWriter

public class NumberedLineWriter
extends java.io.FilterWriter

A writer that put line number in front of every line.

Since:
2.1
Version:
$Id: NumberedLineWriter.java 17672 2006-01-19 00:25:55Z desruisseaux $
Author:
Martin Desruisseaux

Field Summary
static java.io.PrintWriter OUT
          A default numbered line writer to the standard output stream.
 
Fields inherited from class java.io.FilterWriter
out
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
NumberedLineWriter(java.io.Writer out)
          Constructs a stream which will write line number in front of each line.
 
Method Summary
 int getLineNumber()
          Returns the current line number.
 void setLineNumber(int line)
          Sets the current line number.
 void write(char[] buffer, int offset, int length)
          Writes a portion of an array of characters.
 void write(int c)
          Writes a single character.
 void write(java.lang.String string, int offset, int length)
          Writes a portion of a string.
 
Methods inherited from class java.io.FilterWriter
close, flush
 
Methods inherited from class java.io.Writer
write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OUT

public static final java.io.PrintWriter OUT
A default numbered line writer to the standard output stream. The FilterWriter.close() method on this stream will only flush it without closing it.

Constructor Detail

NumberedLineWriter

public NumberedLineWriter(java.io.Writer out)
Constructs a stream which will write line number in front of each line.

Parameters:
out - a Writer object to provide the underlying stream.
Method Detail

getLineNumber

public int getLineNumber()
Returns the current line number.


setLineNumber

public void setLineNumber(int line)
Sets the current line number.

Parameters:
line - The current line number.

write

public void write(int c)
           throws java.io.IOException
Writes a single character.

Throws:
java.io.IOException - If an I/O error occurs

write

public void write(char[] buffer,
                  int offset,
                  int length)
           throws java.io.IOException
Writes a portion of an array of characters.

Parameters:
buffer - Buffer of characters to be written
offset - Offset from which to start reading characters
length - Number of characters to be written
Throws:
java.io.IOException - If an I/O error occurs

write

public void write(java.lang.String string,
                  int offset,
                  int length)
           throws java.io.IOException
Writes a portion of a string.

Parameters:
string - String to be written
offset - Offset from which to start reading characters
length - Number of characters to be written
Throws:
java.io.IOException - If an I/O error occurs


Copyright © GeoTools. All Rights Reserved.