Class BaseStreamableFileService

java.lang.Object
org.red5.server.service.BaseStreamableFileService
All Implemented Interfaces:
IStreamableFileService
Direct Known Subclasses:
FLVService

public abstract class BaseStreamableFileService extends Object implements IStreamableFileService
Base class for streamable file services.
Author:
The Red5 Project, Joachim Bauch (jojo@struktur.de), Paul Gregoire (mondain@gmail.com)
  • Field Details

    • log

      private static final org.slf4j.Logger log
  • Constructor Details

    • BaseStreamableFileService

      public BaseStreamableFileService()
  • Method Details

    • setPrefix

      public void setPrefix(String prefix)
      Sets the prefix.
      Specified by:
      setPrefix in interface IStreamableFileService
      Parameters:
      prefix - prefix
    • getPrefix

      public abstract String getPrefix()
      Getter for prefix. Prefix is used in filename composition to fetch real file name.
      Specified by:
      getPrefix in interface IStreamableFileService
      Returns:
      prefix
    • setExtension

      public void setExtension(String extension)
      Sets the file extensions serviced. If there are more than one, they are separated by commas.
      Specified by:
      setExtension in interface IStreamableFileService
      Parameters:
      extension - extension
    • getExtension

      public abstract String getExtension()
      Getter for extension of file
      Specified by:
      getExtension in interface IStreamableFileService
      Returns:
      File extension that is used
    • prepareFilename

      public String prepareFilename(String name)
      Prepair given string to conform filename requirements, for example, add extension to the end if missing.
      Specified by:
      prepareFilename in interface IStreamableFileService
      Parameters:
      name - String to format
      Returns:
      Correct filename
    • canHandle

      public boolean canHandle(File file)
      Check whether file can be used by file service, that is, it does exist and have valid extension
      Specified by:
      canHandle in interface IStreamableFileService
      Parameters:
      file - File object
      Returns:
      true if file exist and has valid extension, false otherwise
    • getStreamableFile

      public abstract IStreamableFile getStreamableFile(File file) throws IOException
      Return streamable file reference. For FLV files returned streamable file already has generated metadata injected.
      Specified by:
      getStreamableFile in interface IStreamableFileService
      Parameters:
      file - File resource
      Returns:
      Streamable file resource
      Throws:
      IOException - Thrown if there were problems accessing given file