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[] buf,
           int offset)
Checks the header  
buf of the FLV file correctness. | 
static int | 
getAudioCodecByFlvTagCodec(int codec)
Returns audio codec id by flv tag codec. 
 | 
static int | 
getVideoCodecByFlvTagCodec(int codec)
Returns video codec id by flv tag codec. 
 | 
static Flv.Header | 
readHeader(byte[] buf,
          int offset)
Reads the FLV file header from the byte array. 
 | 
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 int | 
writeHeader(byte[] buf,
           int offset,
           Flv.Header header)
 | 
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 int | 
writeTag(java.io.OutputStream os,
        int type,
        long timestamp,
        byte[] buf,
        int offset,
        int length)
Writes tag to the  
os. | 
static int | 
writeTagHeader(byte[] buf,
              int offset,
              int type,
              long timestamp,
              int dataSize)
Writes tag header to the  
buf buffer starting with offset. | 
static int | 
writeTagHeader(java.io.OutputStream os,
              int type,
              long timestamp,
              int dataSize)
Writes tag header to the  
os. | 
static int | 
writeTagTrailer(byte[] buf,
               int offset,
               int dataSize)
Writes tag header to the  
buf buffer starting with offset. | 
static int | 
writeTagTrailer(java.io.OutputStream os,
               int dataSize)
Writes tag trailer to the  
os. | 
public static int getAudioCodecByFlvTagCodec(int codec)
codec - public static int getVideoCodecByFlvTagCodec(int codec)
codec - public static void checkHeader(byte[] buf,
               int offset)
buf of the FLV file correctness.buf - header bufferoffset - header buffer offsetpublic static Flv.Header readHeader(byte[] buf, int offset)
buf - offset - public 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 int writeHeader(byte[] buf,
              int offset,
              Flv.Header header)
buf - offset - header - public 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 int 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 int writeTagHeader(byte[] buf,
                 int offset,
                 int type,
                 long timestamp,
                 int dataSize)
buf buffer starting with offset.buf - offset - type - tag typetimestamp - tag timestampdataSize - data sizepublic static int 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 int writeTagTrailer(byte[] buf,
                  int offset,
                  int dataSize)
buf buffer starting with offset.buf - offset - dataSize - data sizepublic static int 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