## org.red5.io.flv.impl
Class FLV

    java.lang.Object
      org.red5.io.flv.impl.FLV

All Implemented Interfaces:
  IFLV, IStreamableFile

    public class FLV

extends Object
implements IFLV

A FLVImpl implements the FLV api

Author:
  The Red5 Project (red5@osflash.org), Dominick Accattato (daccattato@gmail.com), Luke Hubbard, Codegent Ltd (luke@codegent.com), Paul Gregoire, (mondain@gmail.com)

Field Summary
`protected static Logger` `log`

Constructor Summary
`FLV()` Default constructor, used by Spring so that parameters may be injected.
`FLV(File file)` Create FLV from given file source
`FLV(File file, boolean generateMetadata)` Create FLV from given file source and with specified metadata generation option

Method Summary
`void` `flushHeaders()` Flushes Header
`ITagWriter` `getAppendWriter()` Returns a Writer which is setup to append to the file.
`Map` `getKeyFrameData()` Gets the keyframe data
`IMetaData` `getMetaData()` Returns a map of the metadata
`ITagReader` `getReader()` Returns a reader to parse and read the tags inside the file.
`ITagWriter` `getWriter()` Returns a writer that creates a new file or truncates existing contents.
`boolean` `hasKeyFrameData()` Returns a boolean stating whether a flv has keyframedata
`boolean` `hasMetaData()` Returns a boolean stating whether the flv has metadata
`ITagReader` `readerFromNearestKeyFrame(int seekPoint)` Returns a Reader closest to the nearest keyframe
`void` `refreshHeaders()` Refreshes the headers.
`void` `setCache(ICacheStore cache)` Sets the cache implementation to be used.
`void` `setKeyFrameData(Map keyframedata)` Sets the keyframe data of a flv file
`void` `setMetaData(IMetaData meta)` Sets the metadata
`void` `setMetaService(IMetaService service)` Sets the MetaService through Spring
`ITagWriter` `writerFromNearestKeyFrame(int seekPoint)` Returns a Writer based on the nearest key frame

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### log

    protected static Logger log

Constructor Detail

### FLV

    public FLV()

  Default constructor, used by Spring so that parameters may be injected.

### FLV

    public FLV(File file)

  Create FLV from given file source

  Parameters:
    `file` - File source

### FLV

    public FLV(File file,
               boolean generateMetadata)

  Create FLV from given file source and with specified metadata generation option

  Parameters:
    `file` - File source
    `generateMetadata` - Metadata generation option

Method Detail

### setCache

    public void setCache(ICacheStore cache)

  Sets the cache implementation to be used.

  Specified by:
    `setCache` in interface `IFLV`
  Parameters:
    `cache` - Cache store

### hasMetaData

    public boolean hasMetaData()

  Returns a boolean stating whether the flv has metadata

  Specified by:
    `hasMetaData` in interface `IFLV`
  Returns:
    boolean `true` if file has injected metadata, `false` otherwise

### getMetaData

    public IMetaData getMetaData()
                          throws FileNotFoundException

  Returns a map of the metadata

  Specified by:
    `getMetaData` in interface `IFLV`
  Returns:
    metadata File metadata
  Throws:
    `FileNotFoundException` - File not found

### hasKeyFrameData

    public boolean hasKeyFrameData()

  Returns a boolean stating whether a flv has keyframedata

  Specified by:
    `hasKeyFrameData` in interface `IFLV`
  Returns:
    boolean `true` if file has keyframe metadata, `false` otherwise

### setKeyFrameData

    public void setKeyFrameData(Map keyframedata)

  Sets the keyframe data of a flv file

  Specified by:
    `setKeyFrameData` in interface `IFLV`
  Parameters:
    `keyframedata` - Keyframe metadata

### getKeyFrameData

    public Map getKeyFrameData()

  Gets the keyframe data

  Specified by:
    `getKeyFrameData` in interface `IFLV`
  Returns:
    keyframedata Keyframe metadata

### refreshHeaders

    public void refreshHeaders()
                        throws IOException

  Refreshes the headers. Usually used after data is added to the flv file

  Specified by:
    `refreshHeaders` in interface `IFLV`
  Throws:
    `IOException` - Any I/O exception

### flushHeaders

    public void flushHeaders()
                      throws IOException

  Flushes Header

  Specified by:
    `flushHeaders` in interface `IFLV`
  Throws:
    `IOException` - Any I/O exception

### getReader

    public ITagReader getReader()
                         throws IOException

  Returns a reader to parse and read the tags inside the file.

  Specified by:
    `getReader` in interface `IStreamableFile`
  Returns:
    the reader Tag reader
  Throws:
    `IOException` - I/O exception

### readerFromNearestKeyFrame

    public ITagReader readerFromNearestKeyFrame(int seekPoint)

  Returns a Reader closest to the nearest keyframe

  Specified by:
    `readerFromNearestKeyFrame` in interface `IFLV`
  Parameters:
    `seekPoint` - Point in file we are seeking around
  Returns:
    reader Tag reader closest to that point

### getWriter

    public ITagWriter getWriter()
                         throws IOException

  Returns a writer that creates a new file or truncates existing contents.

  Specified by:
    `getWriter` in interface `IStreamableFile`
  Returns:
    the writer Tag writer
  Throws:
    `IOException` - I/O exception

### getAppendWriter

    public ITagWriter getAppendWriter()
                               throws IOException

  Returns a Writer which is setup to append to the file.

  Specified by:
    `getAppendWriter` in interface `IStreamableFile`
  Returns:
    the writer Tag writer used for append mode
  Throws:
    `IOException` - I/O exception

### writerFromNearestKeyFrame

    public ITagWriter writerFromNearestKeyFrame(int seekPoint)

  Returns a Writer based on the nearest key frame

  Specified by:
    `writerFromNearestKeyFrame` in interface `IFLV`
  Parameters:
    `seekPoint` - Point in file we are seeking around
  Returns:
    writer Tag writer closest to that point

### setMetaData

    public void setMetaData(IMetaData meta)
                     throws IOException

  Sets the metadata

  Specified by:
    `setMetaData` in interface `IFLV`
  Parameters:
    `meta` - Metadata object
  Throws:
    `FileNotFoundException` - File not found
    `IOException` - Any other I/O exception

### setMetaService

    public void setMetaService(IMetaService service)

  Sets the MetaService through Spring

  Specified by:
    `setMetaService` in interface `IFLV`
  Parameters:
    `service` - Metadata service

Copyright © 2006-2010 The Red5 Project