| java.lang.Object com.Ostermiller.util.Tabs
Tabs | public class Tabs (Code) | | Stream editor to alter the line separators on text to match
that of a given platform.
More information about this class is available from ostermiller.org.
author: Stephen Ostermiller http://ostermiller.org/contact.pl?regarding=Java+Utilities since: ostermillerutils 1.00.00 |
Field Summary | |
final public static int | TABS Can be passed instead of a spaces argument to use tabs instead. | protected static ResourceBundle | labels Locale specific strings displayed to the user. | final public static String | version |
Method Summary | |
public static boolean | convert(InputStream in, 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.
Parameters: in - stream that contains the text which needs line number conversion. Parameters: out - stream where converted text is written. | public static boolean | convert(InputStream in, 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.
Parameters: in - stream that contains the text which needs line number conversion. Parameters: out - stream where converted text is written. Parameters: inputTabWidth - number of spaces used instead of a tab in the input. | public static boolean | convert(InputStream in, 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.
The current system's line separator is used.
Parameters: in - stream that contains the text which needs line number conversion. Parameters: out - stream where converted text is written. Parameters: inputTabWidth - number of spaces used instead of a tab in the input. Parameters: outputTabWidth - TABS if tabs should be used, otherwise, number of spaces to use. | public static boolean | convert(InputStream in, 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.
The current system's line separator is used.
Parameters: in - stream that contains the text which needs line number conversion. Parameters: out - stream where converted text is written. Parameters: inputTabWidth - number of spaces used instead of a tab in the input. Parameters: outputTabWidth - TABS if tabs should be used, otherwise, number of spaces to use. Parameters: binaryException - throw an exception and abort the operation if binary data is encountered and binaryExcepion is false. | public static boolean | convert(File f) Change the tabs at the beginning of each line of the file to four spaces.
Guess the tab width of the input file.
Parameters: f - File to be converted. | public static boolean | convert(File f, int inputTabWidth) Change the tabs at the beginning of each line of the file
to the specified number of spaces.
Parameters: f - File to be converted. Parameters: inputTabWidth - number of spaces used instead of a tab in the input, or TAB to guess. | public static boolean | convert(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.
Parameters: f - File to be converted. Parameters: inputTabWidth - number of spaces used instead of a tab in the input, or TAB to guess. Parameters: outputTabWidth - true if tabs should be used, false if spaces should be used. | public static boolean | convert(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.
Parameters: f - File to be converted. Parameters: inputTabWidth - number of spaces used instead of a tab in the input, or TABS to guess. Parameters: outputTabWidth - true if tabs should be used, false if spaces should be used. Parameters: binaryException - throw an exception and abort the operation if binary data is encountered and binaryExcepion is false. | public static int | guessTabWidth(InputStream in) Guess the number of spaces per tab at the beginning of each line. | public static void | main(String[] args) Converts the tabs in files, or standard input. |
TABS | final public static int TABS(Code) | | Can be passed instead of a spaces argument to use tabs instead.
since: ostermillerutils 1.00.00 |
labels | protected static ResourceBundle labels(Code) | | Locale specific strings displayed to the user.
since: ostermillerutils 1.00.00 |
version | final public static String version(Code) | | Version number of this program
since: ostermillerutils 1.00.00 |
convert | public static boolean convert(InputStream in, OutputStream out) throws IOException(Code) | | Read form the input stream, changing the tabs at the beginning of each line
to four spaces, write the result to the output stream.
Parameters: in - stream that contains the text which needs line number conversion. Parameters: out - stream where converted text is written. true if the output was modified from the input, false if it is exactly the same throws: BinaryDataException - if non-text data is encountered. throws: IOException - if an input or output error occurs. since: ostermillerutils 1.00.00 |
convert | public static boolean convert(InputStream in, OutputStream out, int inputTabWidth) throws IOException(Code) | | 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.
Parameters: in - stream that contains the text which needs line number conversion. Parameters: out - stream where converted text is written. Parameters: inputTabWidth - number of spaces used instead of a tab in the input. true if the output was modified from the input, false if it is exactly the same throws: BinaryDataException - if non-text data is encountered. throws: IOException - if an input or output error occurs. throws: IllegalArgumentException - if tab widths are not between 1 and 20 or TABS. since: ostermillerutils 1.00.00 |
convert | public static boolean convert(InputStream in, OutputStream out, int inputTabWidth, int outputTabWidth) throws IOException(Code) | | 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.
The current system's line separator is used.
Parameters: in - stream that contains the text which needs line number conversion. Parameters: out - stream where converted text is written. Parameters: inputTabWidth - number of spaces used instead of a tab in the input. Parameters: outputTabWidth - TABS if tabs should be used, otherwise, number of spaces to use. true if the output was modified from the input, false if it is exactly the same throws: BinaryDataException - if non-text data is encountered. throws: IOException - if an input or output error occurs. since: ostermillerutils 1.00.00 |
convert | public static boolean convert(InputStream in, OutputStream out, int inputTabWidth, int outputTabWidth, boolean binaryException) throws IOException(Code) | | 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.
The current system's line separator is used.
Parameters: in - stream that contains the text which needs line number conversion. Parameters: out - stream where converted text is written. Parameters: inputTabWidth - number of spaces used instead of a tab in the input. Parameters: outputTabWidth - TABS if tabs should be used, otherwise, number of spaces to use. Parameters: binaryException - throw an exception and abort the operation if binary data is encountered and binaryExcepion is false. true if the output was modified from the input, false if it is exactly the same. throws: BinaryDataException - if non-text data is encountered. throws: IOException - if an input or output error occurs. since: ostermillerutils 1.00.00 |
convert | public static boolean convert(File f) throws IOException(Code) | | Change the tabs at the beginning of each line of the file to four spaces.
Guess the tab width of the input file.
Parameters: f - File to be converted. true if the file was modified, false if it was already in the correct format throws: BinaryDataException - if non-text data is encountered. throws: IOException - if an input or output error occurs. since: ostermillerutils 1.00.00 |
convert | public static boolean convert(File f, int inputTabWidth) throws IOException(Code) | | Change the tabs at the beginning of each line of the file
to the specified number of spaces.
Parameters: f - File to be converted. Parameters: inputTabWidth - number of spaces used instead of a tab in the input, or TAB to guess. true if the output was modified from the input, false if it is exactly the same throws: BinaryDataException - if non-text data is encountered. throws: IOException - if an input or output error occurs. throws: IllegalArgumentException - if tab widths are not between 1 and 20 or TABS. since: ostermillerutils 1.00.00 |
convert | public static boolean convert(File f, int inputTabWidth, int outputTabWidth) throws IOException(Code) | | Change the tabs at the beginning of each line of the file
to the specified number of spaces or the other way around.
Parameters: f - File to be converted. Parameters: inputTabWidth - number of spaces used instead of a tab in the input, or TAB to guess. Parameters: outputTabWidth - true if tabs should be used, false if spaces should be used. true if the output was modified from the input, false if it is exactly the same throws: BinaryDataException - if non-text data is encountered. throws: IOException - if an input or output error occurs. since: ostermillerutils 1.00.00 |
convert | public static boolean convert(File f, int inputTabWidth, int outputTabWidth, boolean binaryException) throws IOException(Code) | | Change the tabs at the beginning of each line of the file
to the specified number of spaces or the other way around.
Parameters: f - File to be converted. Parameters: inputTabWidth - number of spaces used instead of a tab in the input, or TABS to guess. Parameters: outputTabWidth - true if tabs should be used, false if spaces should be used. Parameters: binaryException - throw an exception and abort the operation if binary data is encountered and binaryExcepion is false. true if the file was modified, false if it was already in the correct format throws: BinaryDataException - if non-text data is encountered. throws: IOException - if an input or output error occurs. throws: IllegalArgumentException - if tab widths are not between 1 and 20 or TABS. since: ostermillerutils 1.00.00 |
guessTabWidth | public static int guessTabWidth(InputStream in) throws IOException(Code) | | Guess the number of spaces per tab at the beginning of each line.
Parameters: in - Input stream for which to guess tab width the least value (two or greater) which has some line that starts with n times spaces for n zero to max spaces starting a line. throws: IOException - if an input or output error occurs. since: ostermillerutils 1.00.00 |
main | public static void main(String[] args)(Code) | | Converts the tabs in files, or standard input.
Run with --help argument for more information.
Parameters: args - Command line arguments. since: ostermillerutils 1.00.00 |
|
|