|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.tbee.flv.FLVFileParser
public class FLVFileParser
This class provides file level access to the FLV parser. It requires an input stream, where it will read lines upto the max length of all fields and then use the StringParser to split it into fields. This parser allowes for the columns to be separated (ColumnSeparator), making the file more readable. So instead of 12345 you can have 12|3|45. The same goes for the lines (LineSeparator). So instead of 123451234512345, you can have 12345\n12345\n12345. Therefore the length of one "line" is defined as the sum of: - the length of all fields - (number of fields - 1) * the length of the column separator - length of the line separator Note that the last line also must have a line separator, since it is added to the end of the blocksize. Ofcourse any character may be used as column or line separator, since effectively they are simply skipped. The first line may contain header, but is still bound by the sizes set in the StringParser. So if a field is only 1 character, the header can also be only one character. When parsing the header, when the corresponding type has no name (null), the header is set as the name. Usage is straight forward: FLVFileParser lFLVFileParser = new FLVFileParser(); lFLVFileParser.addField( new FLVString(2) ); ... lFLVFileParser.setFirstLineContainsHeader(true); lFLVFileParser.getStringParser().setColumnSeparator(1); lFLVFileParser.setReader( new FileReader(...) ); while (lFLVFileParser.readNextLine() >= 0) { lFLVFileParser.getString(1); lFLVFileParser.getString("F1"); ... }
| Field Summary | |
|---|---|
static String |
SOURCECODE_VERSION
Standard variable for determining version of a class file. |
| Constructor Summary | |
|---|---|
FLVFileParser()
Just the basic constructor Note that a inputstream must be set before the parse method is called |
|
FLVFileParser(InputStream pInputStream)
Usually there is a stream that is parsed This need not be a file inputstream |
|
FLVFileParser(Reader pReader)
Usually there is a stream that is parsed This need not be a file inputstream |
|
| Method Summary | |
|---|---|
void |
addField(FLVString type)
wrappers for the type methods |
void |
configure(Collection sortedMap)
add fields according to the colleection |
void |
configure(nl.knowledgeplaza.util.ConfigurationProperties configurationProperties,
String id)
Find all matching properties in ConfigurationProperties and configure me. |
void |
configure(Properties properties)
Find all matching properties in Properties and configure me. |
Date |
getDate(int idx)
|
Date |
getDate(String name)
|
int |
getFileTerminatorWidth()
The file terminator. |
boolean |
getFirstLineContainsHeader()
The first line may contain header information |
String |
getHeader(int idx)
headers |
long |
getLineNumber()
a line counter |
int |
getLineSeparatorWidth()
The line separator. |
BigDecimal |
getNumber(int idx)
|
BigDecimal |
getNumber(String name)
|
Reader |
getReader()
The stream to be parsed |
String |
getString(int idx)
wrappers for the type methods |
String |
getString(String name)
wrappers for the named-type methods |
FLVStringParser |
getStringParser()
The FLVStringParser used to split up the lines |
static void |
main(String[] args)
|
int |
readNextLine()
Read the next line This method will skip comment lines |
void |
setFileTerminatorWidth(int value)
|
void |
setFirstLineContainsHeader(boolean value)
|
void |
setInputStream(InputStream value)
convenience method |
void |
setLineSeparatorWidth(int value)
|
void |
setReader(Reader value)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String SOURCECODE_VERSION
| Constructor Detail |
|---|
public FLVFileParser()
public FLVFileParser(InputStream pInputStream)
public FLVFileParser(Reader pReader)
| Method Detail |
|---|
public Reader getReader()
public void setReader(Reader value)
public FLVStringParser getStringParser()
public void setInputStream(InputStream value)
public int getLineSeparatorWidth()
public void setLineSeparatorWidth(int value)
public int getFileTerminatorWidth()
public void setFileTerminatorWidth(int value)
public boolean getFirstLineContainsHeader()
public void setFirstLineContainsHeader(boolean value)
public String getHeader(int idx)
public long getLineNumber()
public int readNextLine()
throws IOException
IOExceptionpublic void addField(FLVString type)
public String getString(int idx)
public BigDecimal getNumber(int idx)
public Date getDate(int idx)
public String getString(String name)
public BigDecimal getNumber(String name)
public Date getDate(String name)
public void configure(nl.knowledgeplaza.util.ConfigurationProperties configurationProperties,
String id)
public void configure(Properties properties)
public void configure(Collection sortedMap)
public static void main(String[] args)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||