public final class Flv
extends java.lang.Object
Flv - FLV file format parser.
Format:
[Header][PreviousTagSize0 (U32)][Tag1][PreviousTagSize1 (U32)][Tag2].... ,
where PreviousTagSize* is size of previous tag, including its header.
For FLV version 1, this value is 11 plus the DataSize of the previous tag.
| Modifier and Type | Class and Description |
|---|---|
static class |
Flv.Header
Header - FLV file header. |
static interface |
Flv.ITagProcessor
ITagProcessor - tag processor. |
static class |
Flv.ScriptData
ScriptData - script data. |
static class |
Flv.Tag
Tag - FLV file tag. |
static class |
Flv.TagProcessorAdapter
TagProcessorAdapter - Flv.ITagProcessor adapter. |
| Modifier and Type | Method and Description |
|---|---|
static void |
checkHeader(byte[] header)
Checks the
header of the FLV file correctness. |
static Flv.Header |
readHeader(java.io.InputStream is)
Reads the FLV file header from the
is and points
to the first file tag. |
static Flv.ScriptData[] |
readScriptData(java.io.InputStream is,
int length)
Reads script data from the
is. |
static int |
readTag(java.io.InputStream is,
Flv.ITagProcessor processor)
Reads the tag from the
is |
static void |
writeHeader(java.io.OutputStream os,
Flv.Header header)
Writes the FLV file
header to the os. |
static void |
writeScriptData(java.io.OutputStream os,
Flv.ScriptData[] scriptData)
Writes script data to the
os. |
static void |
writeTag(java.io.OutputStream os,
int type,
long timestamp,
byte[] buf,
int offset,
int length)
Writes tag to the
os. |
static void |
writeTagHeader(java.io.OutputStream os,
int type,
long timestamp,
int dataSize)
Writes tag header to the
os. |
static void |
writeTagTrailer(java.io.OutputStream os,
int dataSize)
Writes tag trailer to the
os. |
public static void checkHeader(byte[] header)
header of the FLV file correctness.header - header bytespublic static Flv.Header readHeader(java.io.InputStream is) throws java.io.IOException
is and points
to the first file tag.is - java.io.IOException - if an I/O exception occurredpublic static void writeHeader(java.io.OutputStream os,
Flv.Header header)
throws java.io.IOException
header to the os.os - header - flv file headerjava.io.IOException - if an I/O exception occurredpublic static int readTag(java.io.InputStream is,
Flv.ITagProcessor processor)
throws java.io.IOException
isis - processor - tag processor-1 if tag is not readjava.io.IOException - if an I/O exception occurredpublic static void writeTag(java.io.OutputStream os,
int type,
long timestamp,
byte[] buf,
int offset,
int length)
throws java.io.IOException
os.os - type - tag typetimestamp - tag timestampbuf - data bufferoffset - data buffer offsetlength - data buffer lengthjava.io.IOException - if an I/O exception occurredpublic static void writeTagHeader(java.io.OutputStream os,
int type,
long timestamp,
int dataSize)
throws java.io.IOException
os.os - type - tag typetimestamp - tag timestampdataSize - data sizejava.io.IOException - if an I/O exception occurredpublic static void writeTagTrailer(java.io.OutputStream os,
int dataSize)
throws java.io.IOException
os.os - dataSize - data sizejava.io.IOException - if an I/O exception occurredpublic static Flv.ScriptData[] readScriptData(java.io.InputStream is, int length) throws java.io.IOException
is.is - length - data lengthjava.io.IOException - if an I/O exception occurredpublic static void writeScriptData(java.io.OutputStream os,
Flv.ScriptData[] scriptData)
throws java.io.IOException
os.os - scriptData - script datajava.io.IOException - if an I/O exception occurred