|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.glassfish.pfl.basic.tools.file.Block
public class Block
Represents a range of Strings, typically read from a file, that are in some sense related and contiguous. Blocks may also be tagged as an aid in transforming a series of blocks.
| Constructor Summary | |
|---|---|
Block(Block block)
Create a new Block which is a copy of block. |
|
Block(List<String> data)
Create a new Block from a list of strings. |
|
| Method Summary | |
|---|---|
void |
addAfterLast(String str)
Add String after the end of the block. |
void |
addBeforeFirst(String str)
Add String before the start of the block. |
void |
addPrefixToAll(String prefix)
Add the prefix to each string in the block. |
void |
addTag(String tag)
Add a tag to the block. |
List<String> |
contents()
Get the contents of the block. |
boolean |
equals(Object obj)
|
Block |
expandTabs()
Replace tabs with spaces, assuming tab stops are located as usual at n*8 + 1 |
String |
find(String search)
Return the first string in the block that contains the search string. |
int |
hashCode()
|
boolean |
hasTag(String tag)
Return whether or not a block has a particular tag. |
boolean |
hasTags(String... tags)
Return whether or not a block has ALL of the listed tags. |
Block |
instantiateTemplate(Map<String,String> parameters)
replace all occurrences of @KEY@ with parameters.get( KEY ). |
org.glassfish.pfl.basic.contain.Pair<Block,Block> |
splitFirst()
Split block into two blocks, with only the first line of the original Block in result.first(). |
Block |
substitute(List<? extends org.glassfish.pfl.basic.contain.Pair<String,String>> substitutions)
|
String |
toString()
|
void |
write(FileWrapper fw)
Write block to FileWrapper. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Block(List<String> data)
public Block(Block block)
| Method Detail |
|---|
public String toString()
toString in class Objectpublic boolean equals(Object obj)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic void addTag(String tag)
public boolean hasTag(String tag)
public boolean hasTags(String... tags)
public List<String> contents()
public void addBeforeFirst(String str)
public void addAfterLast(String str)
public void addPrefixToAll(String prefix)
public String find(String search)
public void write(FileWrapper fw)
throws IOException
IOExceptionpublic Block instantiateTemplate(Map<String,String> parameters)
public Block expandTabs()
public Block substitute(List<? extends org.glassfish.pfl.basic.contain.Pair<String,String>> substitutions)
public org.glassfish.pfl.basic.contain.Pair<Block,Block> splitFirst()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||