Package com.strobel.decompiler
Class LineNumberFormatter
java.lang.Object
com.strobel.decompiler.LineNumberFormatter
A
LineNumberFormatter
is used to rewrite an existing .java file, introducing
line number information. It can handle either, or both, of the following jobs:
- Introduce line numbers as leading comments.
- Stretch the file so that the line number comments match the physical lines.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final File
private final EnumSet
<LineNumberFormatter.LineNumberOption> private final List
<LineNumberPosition> -
Constructor Summary
ConstructorsConstructorDescriptionLineNumberFormatter
(File file, List<LineNumberPosition> lineNumberPositions, EnumSet<LineNumberFormatter.LineNumberOption> options) Constructs an instance. -
Method Summary
Modifier and TypeMethodDescriptionbreakLines
(List<LineNumberPosition> o_LineBrokenPositions) Processes_file
, breaking apart any lines on which multiple line-number markers appear in different columns.private void
emitFormatted
(List<String> brokenLines, List<LineNumberPosition> lineBrokenPositions) void
Rewrites the file passed to 'this' constructor so that the actual line numbers match the recipe passed to 'this' constructor.
-
Field Details
-
_positions
-
_file
-
_options
-
-
Constructor Details
-
LineNumberFormatter
public LineNumberFormatter(File file, List<LineNumberPosition> lineNumberPositions, EnumSet<LineNumberFormatter.LineNumberOption> options) Constructs an instance.- Parameters:
file
- the file whose line numbers should be fixedlineNumberPositions
- a recipe for how to fix the line numbers in 'file'.options
- controls how 'this' represents line numbers in the resulting file
-
-
Method Details
-
reformatFile
Rewrites the file passed to 'this' constructor so that the actual line numbers match the recipe passed to 'this' constructor.- Throws:
IOException
-
breakLines
Processes_file
, breaking apart any lines on which multiple line-number markers appear in different columns.- Returns:
- the list of broken lines
- Throws:
IOException
-
emitFormatted
private void emitFormatted(List<String> brokenLines, List<LineNumberPosition> lineBrokenPositions) throws IOException - Throws:
IOException
-