Class BlockParser
java.lang.Object
org.glassfish.pfl.basic.tools.file.BlockParser
Utility class used to convert FileWrappers into (lists of) Blocks.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Block
getBlock
(FileWrapper fw) Return the contents of the text file as a Block.parseBlocks
(FileWrapper fw, String prefix) Transform fw into a list of blocks.parseBlocks
(FileWrapper fw, String start, String end) Transform fw into a list of blocks.
-
Field Details
-
COMMENT_BLOCK_TAG
- See Also:
-
-
Constructor Details
-
BlockParser
private BlockParser()
-
-
Method Details
-
getBlock
Return the contents of the text file as a Block.- Throws:
IOException
-
parseBlocks
Transform fw into a list of blocks. There are two types of blocks in this list, and they always alternate:- Blocks in which every line starts with prefix, Such blocks are given the tag COMMENT_BLOCK_TAG.
- Blocks in which no line starts with prefix. Such blocks are not tagged.
- Throws:
IOException
-
parseBlocks
Transform fw into a list of blocks. There are two types of blocks in this list, and they always alternate:- Blocks that start with a String containing start, and end with a String containing end. Such blocks are given the tag COMMENT_BLOCK_TAG.
- Blocks that do not contain start or end anywhere
- Throws:
IOException
-