ExtractorUtil
@UnstableApi
class ExtractorUtil
Extractor related utility methods.
Summary
Public functions |
|
|---|---|
java-static Unit |
@PureIf |
java-static Int |
getMaximumEncodedRateBytesPerSecond(@C.Encoding encoding: Int)Returns the maximum encoded rate for samples of the given encoding. |
java-static Boolean |
peekFullyQuietly(Peeks data from |
java-static Int |
peekToLength(Peeks |
java-static Boolean |
readFullyQuietly(Equivalent to |
java-static Boolean |
skipFullyQuietly(input: ExtractorInput!, length: Int)Equivalent to |
Public functions
checkContainerInput
@Pure
java-static fun checkContainerInput(expression: Boolean, message: String?): Unit
If expression is false, throws a container malformed ParserException with the given message. Otherwise, does nothing.
getMaximumEncodedRateBytesPerSecond
java-static fun getMaximumEncodedRateBytesPerSecond(@C.Encoding encoding: Int): Int
Returns the maximum encoded rate for samples of the given encoding.
| Parameters | |
|---|---|
@C.Encoding encoding: Int |
A |
| Returns | |
|---|---|
Int |
The maximum encoded rate for this encoding in bytes per second, or |
peekFullyQuietly
java-static fun peekFullyQuietly(
input: ExtractorInput!,
output: ByteArray!,
offset: Int,
length: Int,
allowEndOfInput: Boolean
): Boolean
Peeks data from input, respecting allowEndOfInput. Returns true if the peek is successful.
If allowEndOfInput=false then encountering the end of the input (whether before or after reading some data) will throw EOFException.
If allowEndOfInput=true then encountering the end of the input (even after reading some data) will return false.
This is slightly different to the behaviour of peekFully, where allowEndOfInput=true only returns false (and suppresses the exception) if the end of the input is reached before reading any data.
| Throws | |
|---|---|
java.io.IOException |
peekToLength
java-static fun peekToLength(
input: ExtractorInput!,
target: ByteArray!,
offset: Int,
length: Int
): Int
Peeks length bytes from the input peek position, or all the bytes to the end of the input if there was less than length bytes left.
If an exception is thrown, there is no guarantee on the peek position.
| Parameters | |
|---|---|
input: ExtractorInput! |
The stream input to peek the data from. |
target: ByteArray! |
A target array into which data should be written. |
offset: Int |
The offset into the target array at which to write. |
length: Int |
The maximum number of bytes to peek from the input. |
| Returns | |
|---|---|
Int |
The number of bytes peeked. |
| Throws | |
|---|---|
java.io.IOException |
If an error occurs peeking from the input. |
readFullyQuietly
java-static fun readFullyQuietly(
input: ExtractorInput!,
output: ByteArray!,
offset: Int,
length: Int
): Boolean
Equivalent to readFully except that it returns
false instead of throwing an EOFException if the end of input is encountered without having fully satisfied the read.
| Throws | |
|---|---|
java.io.IOException |
skipFullyQuietly
java-static fun skipFullyQuietly(input: ExtractorInput!, length: Int): Boolean
Equivalent to skipFully except that it returns false instead of throwing an EOFException if the end of input is encountered without having fully satisfied the skip.
| Throws | |
|---|---|
java.io.IOException |