public class Tabs
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected static java.util.ResourceBundle |
labels
Locale specific strings displayed to the user.
|
static int |
TABS
Can be passed instead of a spaces argument to use tabs instead.
|
static java.lang.String |
version
Version number of this program
|
Constructor and Description |
---|
Tabs() |
Modifier and Type | Method and Description |
---|---|
static boolean |
convert(java.io.File f)
Change the tabs at the beginning of each line of the file to four spaces.
|
static boolean |
convert(java.io.File f,
int inputTabWidth)
Change the tabs at the beginning of each line of the file
to the specified number of spaces.
|
static boolean |
convert(java.io.File f,
int inputTabWidth,
int outputTabWidth)
Change the tabs at the beginning of each line of the file
to the specified number of spaces or the other way around.
|
static boolean |
convert(java.io.File f,
int inputTabWidth,
int outputTabWidth,
boolean binaryException)
Change the tabs at the beginning of each line of the file
to the specified number of spaces or the other way around.
|
static boolean |
convert(java.io.InputStream in,
java.io.OutputStream out)
Read form the input stream, changing the tabs at the beginning of each line
to four spaces, write the result to the output stream.
|
static boolean |
convert(java.io.InputStream in,
java.io.OutputStream out,
int inputTabWidth)
Read form the input stream, changing the tabs at the beginning of each line
to the specified number of spaces, write the result to the output stream.
|
static boolean |
convert(java.io.InputStream in,
java.io.OutputStream out,
int inputTabWidth,
int outputTabWidth)
Read form the input stream, changing the tabs at the beginning of each line
to the specified number of spaces or the other way around, write the result
to the output stream.
|
static boolean |
convert(java.io.InputStream in,
java.io.OutputStream out,
int inputTabWidth,
int outputTabWidth,
boolean binaryException)
Read form the input stream, changing the tabs at the beginning of each line
to the specified number of spaces or the other way around, write the result
to the output stream.
|
static int |
guessTabWidth(java.io.InputStream in)
Guess the number of spaces per tab at the beginning of each line.
|
static void |
main(java.lang.String[] args)
Converts the tabs in files, or standard input.
|
public static final java.lang.String version
protected static java.util.ResourceBundle labels
public static final int TABS
public static void main(java.lang.String[] args)
args
- Command line arguments.public static boolean convert(java.io.InputStream in, java.io.OutputStream out) throws java.io.IOException
in
- stream that contains the text which needs line number conversion.out
- stream where converted text is written.BinaryDataException
- if non-text data is encountered.java.io.IOException
- if an input or output error occurs.public static boolean convert(java.io.InputStream in, java.io.OutputStream out, int inputTabWidth) throws java.io.IOException
in
- stream that contains the text which needs line number conversion.out
- stream where converted text is written.inputTabWidth
- number of spaces used instead of a tab in the input.BinaryDataException
- if non-text data is encountered.java.io.IOException
- if an input or output error occurs.java.lang.IllegalArgumentException
- if tab widths are not between 1 and 20 or TABS.public static boolean convert(java.io.InputStream in, java.io.OutputStream out, int inputTabWidth, int outputTabWidth) throws java.io.IOException
in
- stream that contains the text which needs line number conversion.out
- stream where converted text is written.inputTabWidth
- number of spaces used instead of a tab in the input.outputTabWidth
- TABS if tabs should be used, otherwise, number of spaces to use.BinaryDataException
- if non-text data is encountered.java.io.IOException
- if an input or output error occurs.public static boolean convert(java.io.InputStream in, java.io.OutputStream out, int inputTabWidth, int outputTabWidth, boolean binaryException) throws java.io.IOException
in
- stream that contains the text which needs line number conversion.out
- stream where converted text is written.inputTabWidth
- number of spaces used instead of a tab in the input.outputTabWidth
- TABS if tabs should be used, otherwise, number of spaces to use.binaryException
- throw an exception and abort the operation if binary data is encountered and binaryExcepion is false.BinaryDataException
- if non-text data is encountered.java.io.IOException
- if an input or output error occurs.public static boolean convert(java.io.File f) throws java.io.IOException
f
- File to be converted.BinaryDataException
- if non-text data is encountered.java.io.IOException
- if an input or output error occurs.public static boolean convert(java.io.File f, int inputTabWidth) throws java.io.IOException
f
- File to be converted.inputTabWidth
- number of spaces used instead of a tab in the input, or TAB to guess.BinaryDataException
- if non-text data is encountered.java.io.IOException
- if an input or output error occurs.java.lang.IllegalArgumentException
- if tab widths are not between 1 and 20 or TABS.public static boolean convert(java.io.File f, int inputTabWidth, int outputTabWidth) throws java.io.IOException
f
- File to be converted.inputTabWidth
- number of spaces used instead of a tab in the input, or TAB to guess.outputTabWidth
- true if tabs should be used, false if spaces should be used.BinaryDataException
- if non-text data is encountered.java.io.IOException
- if an input or output error occurs.public static boolean convert(java.io.File f, int inputTabWidth, int outputTabWidth, boolean binaryException) throws java.io.IOException
f
- File to be converted.inputTabWidth
- number of spaces used instead of a tab in the input, or TABS to guess.outputTabWidth
- true if tabs should be used, false if spaces should be used.binaryException
- throw an exception and abort the operation if binary data is encountered and binaryExcepion is false.BinaryDataException
- if non-text data is encountered.java.io.IOException
- if an input or output error occurs.java.lang.IllegalArgumentException
- if tab widths are not between 1 and 20 or TABS.public static int guessTabWidth(java.io.InputStream in) throws java.io.IOException
in
- Input stream for which to guess tab widthjava.io.IOException
- if an input or output error occurs.Copyright (c) 2001-2020 by Stephen Ostermiller