public static class IOUtil.LineInformation
extends java.lang.Object
IOUtil.computeLineInformation(File)
and
IOUtil.computeLineInformation(InputStream)
.Modifier and Type | Field and Description |
---|---|
private int |
offset
The offset of the line from beginning of the file.
|
private int[] |
tabIndices
The indices of all tabs in the line.
|
Constructor and Description |
---|
LineInformation(int offset,
java.util.List<java.lang.Integer> tabIndices)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
getOffset()
Returns the indices of all tabs in the line.
|
int[] |
getTabIndices()
Returns the indices of all tabs in the line.
|
int |
normalizeColumn(int column,
int tabWidth)
Computes for the given column index (a tab represents multiple columns)
in this line information the normalized column index in that each tab character
represents only one sign.
|
private int offset
private int[] tabIndices
public LineInformation(int offset, java.util.List<java.lang.Integer> tabIndices)
offset
- The offset of the line from beginning of the file.tabIndices
- The indices of all tabs in the line.public int getOffset()
public int[] getTabIndices()
public int normalizeColumn(int column, int tabWidth)
Computes for the given column index (a tab represents multiple columns) in this line information the normalized column index in that each tab character represents only one sign.
Example line: AB\tCD EF GH\t\tIJ\t.
Example normalizations:
normalizeColumn(0, 3) = 0 which is character 'A' normalizeColumn(1, 3) = 1 which is character 'B' normalizeColumn(2, 3) = 2 which is character ' ' normalizeColumn(3, 3) = 2 which is character ' ' normalizeColumn(4, 3) = 2 which is character ' ' normalizeColumn(5, 3) = 3 which is character 'C' normalizeColumn(6, 3) = 4 which is character 'D' normalizeColumn(7, 3) = 5 which is character ' ' normalizeColumn(8, 3) = 6 which is character 'E' normalizeColumn(9, 3) = 7 which is character 'F' normalizeColumn(10, 3) = 8 which is character ' ' normalizeColumn(11, 3) = 9 which is character 'G' normalizeColumn(12, 3) = 10 which is character 'H' normalizeColumn(13, 3) = 11 which is character ' ' normalizeColumn(14, 3) = 11 which is character ' ' normalizeColumn(15, 3) = 11 which is character ' ' normalizeColumn(16, 3) = 12 which is character ' ' normalizeColumn(17, 3) = 12 which is character ' ' normalizeColumn(18, 3) = 12 which is character ' ' normalizeColumn(19, 3) = 13 which is character 'I' normalizeColumn(20, 3) = 14 which is character 'J' normalizeColumn(21, 3) = 15 which is character ' ' normalizeColumn(22, 3) = 15 which is character ' ' normalizeColumn(23, 3) = 15 which is character ' ' normalizeColumn(24, 3) = 16 which is character '.' normalizeColumn(25, 3) = 17 normalizeColumn(26, 3) = 18
column
- The column where tabs represents multiple characters. If the column is negative this value is returned.tabWidth
- The tab width which must be greater as 1
, otherwise the column index is returned.