Package org.geotools.util
Class ExpandedTabWriter
Object
Writer
FilterWriter
ExpandedTabWriter
- All Implemented Interfaces:
Closeable,Flushable,Appendable,AutoCloseable
Writes characters to a stream while expanding tabs (
'\t') into spaces.- Since:
- 2.0
- Author:
- Martin Desruisseaux (IRD)
-
Field Summary
Fields inherited from class FilterWriter
out -
Constructor Summary
ConstructorsConstructorDescriptionExpandedTabWriter(Writer out) Constructs a filter which replaces tab characters ('\t') by spaces.ExpandedTabWriter(Writer out, int tabWidth) Constructs a filter which replaces tab characters ('\t') by spaces, using the specified tab width. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the tab width.voidsetTabWidth(int tabWidth) Sets the tab width.voidwrite(char[] buffer, int offset, int length) Writes a portion of an array of characters.voidwrite(int c) Writes a single character.voidWrites a portion of a string.Methods inherited from class FilterWriter
close, flush
-
Constructor Details
-
ExpandedTabWriter
Constructs a filter which replaces tab characters ('\t') by spaces. Tab widths default to 8 characters.- Parameters:
out- A writer object to provide the underlying stream.
-
ExpandedTabWriter
Constructs a filter which replaces tab characters ('\t') by 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:
IllegalArgumentException- iftabWidthis not greater than 0.
-
-
Method Details
-
setTabWidth
Sets the tab width.- Parameters:
tabWidth- The tab width. Must be greater than 0.- Throws:
IllegalArgumentException- iftabWidthis not greater than 0.
-
getTabWidth
public int getTabWidth()Returns the tab width.- Returns:
- The tabulation width.
-
write
Writes a single character.- Overrides:
writein classFilterWriter- Throws:
IOException- If an I/O error occurs.
-
write
Writes a portion of an array of characters.- Overrides:
writein classFilterWriter- Parameters:
buffer- Buffer of characters to be writtenoffset- Offset from which to start reading characterslength- Number of characters to be written- Throws:
IOException- If an I/O error occurs.
-
write
Writes a portion of a string.- Overrides:
writein classFilterWriter- Parameters:
string- String to be writtenoffset- Offset from which to start reading characterslength- Number of characters to be written- Throws:
IOException- If an I/O error occurs.
-