org.geotools.io
Class ExpandedTabWriter

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

public class ExpandedTabWriter
extends java.io.FilterWriter

Writes characters to a stream while expanding tabs ('\t') into spaces.

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

Field Summary
 
Fields inherited from class java.io.FilterWriter
out
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
ExpandedTabWriter(java.io.Writer out)
          Constructs a filter which replaces tab characters ('\t') with spaces.
ExpandedTabWriter(java.io.Writer out, int tabWidth)
          Constructs a filter which replaces tab characters ('\t') with spaces, using the specified tab width.
 
Method Summary
 int getTabWidth()
          Returns the tab width.
 void setTabWidth(int tabWidth)
          Sets the tab width.
 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
 

Constructor Detail

ExpandedTabWriter

public ExpandedTabWriter(java.io.Writer out)
Constructs a filter which replaces tab characters ('\t') with spaces. Tab widths default to 8 characters.

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

ExpandedTabWriter

public ExpandedTabWriter(java.io.Writer out,
                         int tabWidth)
                  throws java.lang.IllegalArgumentException
Constructs a filter which replaces tab characters ('\t') with spaces, using the specified tab width.

Parameters:
out - a Writer object to provide the underlying stream.
tabWidth - The tab width. Must be greater than 0.
Throws:
java.lang.IllegalArgumentException - if is not greater than 0.
Method Detail

setTabWidth

public void setTabWidth(int tabWidth)
                 throws java.lang.IllegalArgumentException
Sets the tab width.

Parameters:
tabWidth - The tab width. Must be greater than 0.
Throws:
java.lang.IllegalArgumentException - if is not greater than 0.

getTabWidth

public int getTabWidth()
Returns the tab width.


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.