Class BlockParser
- java.lang.Object
-
- org.glassfish.pfl.basic.tools.file.BlockParser
-
public class BlockParser extends java.lang.Object
Utility class used to convert FileWrappers into (lists of) Blocks.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
COMMENT_BLOCK_TAG
-
Constructor Summary
Constructors Modifier Constructor Description private
BlockParser()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Block
getBlock(FileWrapper fw)
Return the contents of the text file as a Block.static java.util.List<Block>
parseBlocks(FileWrapper fw, java.lang.String prefix)
Transform fw into a list of blocks.static java.util.List<Block>
parseBlocks(FileWrapper fw, java.lang.String start, java.lang.String end)
Transform fw into a list of blocks.
-
-
-
Field Detail
-
COMMENT_BLOCK_TAG
public static final java.lang.String COMMENT_BLOCK_TAG
- See Also:
- Constant Field Values
-
-
Method Detail
-
getBlock
public static Block getBlock(FileWrapper fw) throws java.io.IOException
Return the contents of the text file as a Block.- Throws:
java.io.IOException
-
parseBlocks
public static java.util.List<Block> parseBlocks(FileWrapper fw, java.lang.String prefix) throws java.io.IOException
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:
java.io.IOException
-
parseBlocks
public static java.util.List<Block> parseBlocks(FileWrapper fw, java.lang.String start, java.lang.String end) throws java.io.IOException
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:
java.io.IOException
-
-