Package org.red5.server.service
Class BaseStreamableFileService
java.lang.Object
org.red5.server.service.BaseStreamableFileService
- All Implemented Interfaces:
IStreamableFileService
- Direct Known Subclasses:
FLVService
Base class for streamable file services.
- Author:
- The Red5 Project, Joachim Bauch ([email protected]), Paul Gregoire ([email protected])
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanCheck whether file can be used by file service, that is, it does exist and have valid extensionabstract StringGetter for extension of fileabstract StringGetter for prefix.abstract IStreamableFilegetStreamableFile(File file) Return streamable file reference.prepareFilename(String name) Prepair given string to conform filename requirements, for example, add extension to the end if missing.voidsetExtension(String extension) Sets the file extensions serviced.voidSets the prefix.
-
Field Details
-
log
private static final org.slf4j.Logger log
-
-
Constructor Details
-
BaseStreamableFileService
public BaseStreamableFileService()
-
-
Method Details
-
setPrefix
Sets the prefix.- Specified by:
setPrefixin interfaceIStreamableFileService- Parameters:
prefix- prefix
-
getPrefix
Getter for prefix. Prefix is used in filename composition to fetch real file name.- Specified by:
getPrefixin interfaceIStreamableFileService- Returns:
- prefix
-
setExtension
Sets the file extensions serviced. If there are more than one, they are separated by commas.- Specified by:
setExtensionin interfaceIStreamableFileService- Parameters:
extension- extension
-
getExtension
Getter for extension of file- Specified by:
getExtensionin interfaceIStreamableFileService- Returns:
- File extension that is used
-
prepareFilename
Prepair given string to conform filename requirements, for example, add extension to the end if missing.- Specified by:
prepareFilenamein interfaceIStreamableFileService- Parameters:
name- String to format- Returns:
- Correct filename
-
canHandle
Check whether file can be used by file service, that is, it does exist and have valid extension- Specified by:
canHandlein interfaceIStreamableFileService- Parameters:
file- File object- Returns:
- true if file exist and has valid extension, false otherwise
-
getStreamableFile
Return streamable file reference. For FLV files returned streamable file already has generated metadata injected.- Specified by:
getStreamableFilein interfaceIStreamableFileService- Parameters:
file- File resource- Returns:
- Streamable file resource
- Throws:
IOException- Thrown if there were problems accessing given file
-