Package backend.speech
Class LoadVideoFromGridFS
java.lang.Object
backend.speech.LoadVideoFromGridFS
Class for loading video files from MongoDB GridFS.
Modified to use the connection pool.
- Author:
- Kai
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor that uses the pooled connectionLoadVideoFromGridFS(MongoDBHandler mongoDbHandler) Constructor that takes a specific MongoDB handler -
Method Summary
Modifier and TypeMethodDescriptionGet the speech DAO instance.getVideoBase64(Speech_impl speechImpl) Retrieves a video from GridFS and returns it as a Base64-encoded string with its MIME type.byte[]loadVideo(org.bson.types.ObjectId videoId) Loads a video file by its GridFS ID and returns it as a byte array.static voidExample usage of this class.
-
Constructor Details
-
LoadVideoFromGridFS
Constructor that takes a specific MongoDB handler- Parameters:
mongoDbHandler- The MongoDB handler to use
-
LoadVideoFromGridFS
public LoadVideoFromGridFS()Default constructor that uses the pooled connection
-
-
Method Details
-
main
Example usage of this class. -
loadVideo
Loads a video file by its GridFS ID and returns it as a byte array.- Parameters:
videoId- The ObjectId of the video file in GridFS- Returns:
- The byte array of the file
- Throws:
IOException- If an I/O error occurs
-
getVideoBase64
Retrieves a video from GridFS and returns it as a Base64-encoded string with its MIME type.- Parameters:
speechImpl- The speech implementation containing video info- Returns:
- HashMap containing the Base64-encoded video and its MIME type
- Throws:
IOException- If an I/O error occurs
-
getSpeechDAO
Get the speech DAO instance.- Returns:
- The SpeechDAO instance
-