java.lang.Object
java.io.Reader
org.bzdev.io.DetabReader
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Readable
Reader to remove tabs.
The tab spacing is assumed to be 8 unless explicitly set in
a constructor.
Formats such as YAML that use indentation to denote nesting do not allow tabs because the tab spacing cannot be predicted. While 8 is a common number, some editors can be configured to use a different value.
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor.DetabReader
(Reader r, int tabspacing) Constructor with an explicit tab spacing. -
Method Summary
Methods inherited from class java.io.Reader
mark, markSupported, nullReader, read, read, ready, reset, skip, transferTo
-
Constructor Details
-
DetabReader
Constructor.- Parameters:
r
- a reader.
-
DetabReader
Constructor with an explicit tab spacing.- Parameters:
r
- a reader.tabspacing
- the tab spacing- Throws:
IllegalArgumentException
- if the tab spacing is less than 1
-
-
Method Details
-
getTabSpacing
public int getTabSpacing()Get the tab spacing.- Returns:
- the tab spacing
-
read
- Overrides:
read
in classReader
- Throws:
IOException
-
read
- Specified by:
read
in classReader
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in classReader
- Throws:
IOException
-