Class ExtractorUtil

  • @Deprecated
    public final class ExtractorUtil
    extends Object
    Deprecated. is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.
    Extractor related utility methods.
    • Method Detail

      • peekToLength

        public static int peekToLength​(ExtractorInput input,
                                       byte[] target,
                                       int offset,
                                       int length)
                                throws IOException
        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.

        input - The stream input to peek the data from.
        target - A target array into which data should be written.
        offset - The offset into the target array at which to write.
        length - The maximum number of bytes to peek from the input.
        The number of bytes peeked.
        IOException - If an error occurs peeking from the input.
      • peekFullyQuietly

        public static boolean peekFullyQuietly​(ExtractorInput input,
                                               byte[] output,
                                               int offset,
                                               int length,
                                               boolean allowEndOfInput)
                                        throws IOException
        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 ExtractorInput.peekFully(byte[], int, int, boolean), where allowEndOfInput=true only returns false (and suppresses the exception) if the end of the input is reached before reading any data.