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 (jojo@struktur.de), Paul Gregoire (mondain@gmail.com)
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Check whether file can be used by file service, that is, it does exist and have valid extensionabstract String
Getter for extension of fileabstract String
Getter for prefix.abstract IStreamableFile
getStreamableFile
(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.void
setExtension
(String extension) Sets the file extensions serviced.void
Sets 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:
setPrefix
in interfaceIStreamableFileService
- Parameters:
prefix
- prefix
-
getPrefix
Getter for prefix. Prefix is used in filename composition to fetch real file name.- Specified by:
getPrefix
in interfaceIStreamableFileService
- Returns:
- prefix
-
setExtension
Sets the file extensions serviced. If there are more than one, they are separated by commas.- Specified by:
setExtension
in interfaceIStreamableFileService
- Parameters:
extension
- extension
-
getExtension
Getter for extension of file- Specified by:
getExtension
in 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:
prepareFilename
in 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:
canHandle
in 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:
getStreamableFile
in interfaceIStreamableFileService
- Parameters:
file
- File resource- Returns:
- Streamable file resource
- Throws:
IOException
- Thrown if there were problems accessing given file
-