Top Description Fields Constructors Methods
org.glassfish.pfl.basic.tools.file

public Class BlockParser

extends Object
Class Inheritance
Imports
java.io.IOException, java.util.ArrayList, .List, org.glassfish.pfl.basic.func.BinaryFunction

Utility class used to convert FileWrappers into (lists of) Blocks.

Field Summary

Modifier and TypeField and Description
public static final String

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static Block
getBlock(final FileWrapper fw)

Return the contents of the text file as a Block.

public static List<Block>
parseBlocks(final FileWrapper fw, final String prefix)

Transform fw into a list of blocks.

public static List<Block>
parseBlocks(final FileWrapper fw, final String start, final String end)

Transform fw into a list of blocks.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

COMMENT_BLOCK_TAGback to summary
public static final String COMMENT_BLOCK_TAG

Constructor Detail

BlockParserback to summary
private BlockParser()

Method Detail

getBlockback to summary
public static Block getBlock(final FileWrapper fw) throws IOException

Return the contents of the text file as a Block.

parseBlocksback to summary
public static List<Block> parseBlocks(final FileWrapper fw, final String prefix) throws 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.
parseBlocksback to summary
public static List<Block> parseBlocks(final FileWrapper fw, final String start, final String end) throws 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