org.red5.io

## Class BaseStreamableFileService

- java.lang.Object
- - org.red5.io.BaseStreamableFileService

All Implemented Interfaces:
  IStreamableFileService

Direct Known Subclasses:
  FLVService, M4AService, MP3Service, MP4Service

    public abstract class BaseStreamableFileService
    extends Object
    implements IStreamableFileService

Base class for streamable file services.

Author:
  The Red5 Project (red5@osflash.org), Joachim Bauch (jojo@struktur.de), Paul Gregoire (mondain@gmail.com)

### Constructor Summary

Constructors
Constructor and Description
`BaseStreamableFileService()`

### Method Summary

Methods
`boolean` `canHandle(File file)` Check whether file can be used by file service, that is, it does exist and have valid extension
`abstract String` `getExtension()` Getter for extension of file
`abstract String` `getPrefix()` Getter for prefix.
`abstract IStreamableFile` `getStreamableFile(File file)` Return streamable file reference.
`String` `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` `setPrefix(String prefix)` Sets the prefix.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### BaseStreamableFileService

    public BaseStreamableFileService()

### Method Detail

#### setPrefix

    public void setPrefix(String prefix)

Sets the prefix.

Specified by:
  `setPrefix` in interface `IStreamableFileService`

#### 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`

#### 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