# ParserException

Artifact: [androidx.media3:media3-common](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/common/ParserException.java+class:androidx.media3.common.ParserException)

*** ** * ** ***


```
@UnstableApi
public class ParserException extends IOException
```

<br />

|---|---|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||||
| ↳ | [kotlin.Throwable](https://developer.android.com/reference/java/lang/Throwable.html) ||||
|   | ↳ | [java.lang.Exception](https://developer.android.com/reference/java/lang/Exception.html) |||
|   |   | ↳ | [java.io.IOException](https://developer.android.com/reference/java/io/IOException.html) ||
|   |   |   | ↳ | [androidx.media3.common.ParserException](https://developer.android.com/reference/androidx/media3/common/ParserException) |

Known direct subclasses [SsManifestParser.MissingFieldException](https://developer.android.com/reference/androidx/media3/exoplayer/smoothstreaming/manifest/SsManifestParser.MissingFieldException), [UnrecognizedInputFormatException](https://developer.android.com/reference/androidx/media3/exoplayer/source/UnrecognizedInputFormatException)

|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/smoothstreaming/manifest/SsManifestParser.MissingFieldException` | Thrown if a required field is missing. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/source/UnrecognizedInputFormatException` | Thrown if the input format was not recognized. |

*** ** * ** ***

Thrown when an error occurs parsing media data and metadata.

## Summary

| ### Public fields |
|---|---|
| `final boolean` | `https://developer.android.com/reference/androidx/media3/common/ParserException#contentIsMalformed()` Whether the parsing error was caused by a bitstream not following the expected format. |
| `final int` | `https://developer.android.com/reference/androidx/media3/common/ParserException#dataType()` The `https://developer.android.com/reference/androidx/media3/common/C.DataType` of the parsed bitstream. |

| ### Protected constructors |
|---|
| `https://developer.android.com/reference/androidx/media3/common/ParserException#ParserException(java.lang.String,java.lang.Throwable,boolean,int)( @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html message, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Throwable.html cause, boolean contentIsMalformed, @https://developer.android.com/reference/androidx/media3/common/C.DataType int dataType )` |

| ### Public methods |
|---|---|
| `static https://developer.android.com/reference/androidx/media3/common/ParserException` | `https://developer.android.com/reference/androidx/media3/common/ParserException#createForMalformedContainer(java.lang.String,java.lang.Throwable)( @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html message, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Throwable.html cause )` Creates a new instance for which `https://developer.android.com/reference/androidx/media3/common/ParserException#contentIsMalformed()` is true and `https://developer.android.com/reference/androidx/media3/common/ParserException#dataType()` is `https://developer.android.com/reference/androidx/media3/common/C#DATA_TYPE_MEDIA()`. |
| `static https://developer.android.com/reference/androidx/media3/common/ParserException` | `https://developer.android.com/reference/androidx/media3/common/ParserException#createForMalformedDataOfUnknownType(java.lang.String,java.lang.Throwable)( @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html message, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Throwable.html cause )` Creates a new instance for which `https://developer.android.com/reference/androidx/media3/common/ParserException#contentIsMalformed()` is true and `https://developer.android.com/reference/androidx/media3/common/ParserException#dataType()` is `https://developer.android.com/reference/androidx/media3/common/C#DATA_TYPE_UNKNOWN()`. |
| `static https://developer.android.com/reference/androidx/media3/common/ParserException` | `https://developer.android.com/reference/androidx/media3/common/ParserException#createForMalformedManifest(java.lang.String,java.lang.Throwable)( @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html message, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Throwable.html cause )` Creates a new instance for which `https://developer.android.com/reference/androidx/media3/common/ParserException#contentIsMalformed()` is true and `https://developer.android.com/reference/androidx/media3/common/ParserException#dataType()` is `https://developer.android.com/reference/androidx/media3/common/C#DATA_TYPE_MANIFEST()`. |
| `static https://developer.android.com/reference/androidx/media3/common/ParserException` | `https://developer.android.com/reference/androidx/media3/common/ParserException#createForMalformedSteeringManifest(java.lang.String,java.lang.Throwable)( @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html message, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Throwable.html cause )` Creates a new instance for which `https://developer.android.com/reference/androidx/media3/common/ParserException#contentIsMalformed()` is true and `https://developer.android.com/reference/androidx/media3/common/ParserException#dataType()` is `https://developer.android.com/reference/androidx/media3/common/C#DATA_TYPE_STEERING_MANIFEST()`. |
| `static https://developer.android.com/reference/androidx/media3/common/ParserException` | `https://developer.android.com/reference/androidx/media3/common/ParserException#createForManifestWithUnsupportedFeature(java.lang.String,java.lang.Throwable)( @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html message, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Throwable.html cause )` Creates a new instance for which `https://developer.android.com/reference/androidx/media3/common/ParserException#contentIsMalformed()` is false and `https://developer.android.com/reference/androidx/media3/common/ParserException#dataType()` is `https://developer.android.com/reference/androidx/media3/common/C#DATA_TYPE_MANIFEST()`. |
| `static https://developer.android.com/reference/androidx/media3/common/ParserException` | `https://developer.android.com/reference/androidx/media3/common/ParserException#createForUnsupportedContainerFeature(java.lang.String)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html message)` Creates a new instance for which `https://developer.android.com/reference/androidx/media3/common/ParserException#contentIsMalformed()` is false and `https://developer.android.com/reference/androidx/media3/common/ParserException#dataType()` is `https://developer.android.com/reference/androidx/media3/common/C#DATA_TYPE_MEDIA()`. |
| `https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/media3/common/ParserException#getMessage()()` |

### Inherited methods

From [java.lang.Throwable](https://developer.android.com/reference/java/lang/Throwable.html) `synchronized final void` `https://developer.android.com/reference/java/lang/Throwable.html#addSuppressed(java.lang.Throwable)(https://developer.android.com/reference/java/lang/Throwable.html exception)` `synchronized https://developer.android.com/reference/java/lang/Throwable.html` `https://developer.android.com/reference/java/lang/Throwable.html#fillInStackTrace()()` `synchronized https://developer.android.com/reference/java/lang/Throwable.html` `https://developer.android.com/reference/java/lang/Throwable.html#getCause()()` `https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/java/lang/Throwable.html#getLocalizedMessage()()` `StackTraceElement[]` `https://developer.android.com/reference/java/lang/Throwable.html#getStackTrace()()` `synchronized final Throwable[]` `https://developer.android.com/reference/java/lang/Throwable.html#getSuppressed()()` `synchronized https://developer.android.com/reference/java/lang/Throwable.html` `https://developer.android.com/reference/java/lang/Throwable.html#initCause(java.lang.Throwable)(https://developer.android.com/reference/java/lang/Throwable.html cause)` `void` `https://developer.android.com/reference/java/lang/Throwable.html#printStackTrace()()` `void` `https://developer.android.com/reference/java/lang/Throwable.html#setStackTrace(java.lang.StackTraceElement[])(StackTraceElement[] stackTrace)` `https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/java/lang/Throwable.html#toString()()`

## Public fields

### contentIsMalformed

```
public final boolean contentIsMalformed
```

Whether the parsing error was caused by a bitstream not following the expected format. May be false when a parser encounters a legal condition which it does not support.

### dataType

```
public final int dataType
```

The `https://developer.android.com/reference/androidx/media3/common/C.DataType` of the parsed bitstream.

## Protected constructors

### ParserException

```
protected ParserException(
    @Nullable String message,
    @Nullable Throwable cause,
    boolean contentIsMalformed,
    @C.DataType int dataType
)
```

## Public methods

### createForMalformedContainer

```
public static ParserException createForMalformedContainer(
    @Nullable String message,
    @Nullable Throwable cause
)
```

Creates a new instance for which `https://developer.android.com/reference/androidx/media3/common/ParserException#contentIsMalformed()` is true and `https://developer.android.com/reference/androidx/media3/common/ParserException#dataType()` is `https://developer.android.com/reference/androidx/media3/common/C#DATA_TYPE_MEDIA()`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html message` | See `https://developer.android.com/reference/androidx/media3/common/ParserException#getMessage()`. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Throwable.html cause` | See `https://developer.android.com/reference/java/lang/Throwable.html#getCause()`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/ParserException` | The created instance. |

### createForMalformedDataOfUnknownType

```
public static ParserException createForMalformedDataOfUnknownType(
    @Nullable String message,
    @Nullable Throwable cause
)
```

Creates a new instance for which `https://developer.android.com/reference/androidx/media3/common/ParserException#contentIsMalformed()` is true and `https://developer.android.com/reference/androidx/media3/common/ParserException#dataType()` is `https://developer.android.com/reference/androidx/media3/common/C#DATA_TYPE_UNKNOWN()`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html message` | See `https://developer.android.com/reference/androidx/media3/common/ParserException#getMessage()`. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Throwable.html cause` | See `https://developer.android.com/reference/java/lang/Throwable.html#getCause()`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/ParserException` | The created instance. |

### createForMalformedManifest

```
public static ParserException createForMalformedManifest(
    @Nullable String message,
    @Nullable Throwable cause
)
```

Creates a new instance for which `https://developer.android.com/reference/androidx/media3/common/ParserException#contentIsMalformed()` is true and `https://developer.android.com/reference/androidx/media3/common/ParserException#dataType()` is `https://developer.android.com/reference/androidx/media3/common/C#DATA_TYPE_MANIFEST()`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html message` | See `https://developer.android.com/reference/androidx/media3/common/ParserException#getMessage()`. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Throwable.html cause` | See `https://developer.android.com/reference/java/lang/Throwable.html#getCause()`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/ParserException` | The created instance. |

### createForMalformedSteeringManifest

```
public static ParserException createForMalformedSteeringManifest(
    @Nullable String message,
    @Nullable Throwable cause
)
```

Creates a new instance for which `https://developer.android.com/reference/androidx/media3/common/ParserException#contentIsMalformed()` is true and `https://developer.android.com/reference/androidx/media3/common/ParserException#dataType()` is `https://developer.android.com/reference/androidx/media3/common/C#DATA_TYPE_STEERING_MANIFEST()`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html message` | See `https://developer.android.com/reference/androidx/media3/common/ParserException#getMessage()`. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Throwable.html cause` | See `https://developer.android.com/reference/java/lang/Throwable.html#getCause()`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/ParserException` | The created instance. |

### createForManifestWithUnsupportedFeature

```
public static ParserException createForManifestWithUnsupportedFeature(
    @Nullable String message,
    @Nullable Throwable cause
)
```

Creates a new instance for which `https://developer.android.com/reference/androidx/media3/common/ParserException#contentIsMalformed()` is false and `https://developer.android.com/reference/androidx/media3/common/ParserException#dataType()` is `https://developer.android.com/reference/androidx/media3/common/C#DATA_TYPE_MANIFEST()`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html message` | See `https://developer.android.com/reference/androidx/media3/common/ParserException#getMessage()`. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Throwable.html cause` | See `https://developer.android.com/reference/java/lang/Throwable.html#getCause()`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/ParserException` | The created instance. |

### createForUnsupportedContainerFeature

```
public static ParserException createForUnsupportedContainerFeature(@Nullable String message)
```

Creates a new instance for which `https://developer.android.com/reference/androidx/media3/common/ParserException#contentIsMalformed()` is false and `https://developer.android.com/reference/androidx/media3/common/ParserException#dataType()` is `https://developer.android.com/reference/androidx/media3/common/C#DATA_TYPE_MEDIA()`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html message` | See `https://developer.android.com/reference/androidx/media3/common/ParserException#getMessage()`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/ParserException` | The created instance. |

### getMessage

```
public String getMessage()
```