Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
1c429417
authored
May 20, 2021
by
aquilescanta
Committed by
Oliver Woodman
May 21, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add contentIsMalformed and dataType to ParserException
PiperOrigin-RevId: 374874272
parent
08259f89
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
6 deletions
library/common/src/main/java/com/google/android/exoplayer2/ParserException.java
library/common/src/main/java/com/google/android/exoplayer2/ParserException.java
View file @
1c429417
...
@@ -15,30 +15,101 @@
...
@@ -15,30 +15,101 @@
*/
*/
package
com
.
google
.
android
.
exoplayer2
;
package
com
.
google
.
android
.
exoplayer2
;
import
androidx.annotation.Nullable
;
import
com.google.android.exoplayer2.C.DataType
;
import
java.io.IOException
;
import
java.io.IOException
;
/** Thrown when an error occurs parsing media data and metadata. */
/** Thrown when an error occurs parsing media data and metadata. */
public
class
ParserException
extends
IOException
{
public
class
ParserException
extends
IOException
{
/**
* Creates a new instance for which {@link #contentIsMalformed} is true and {@link #dataType} is
* {@link C#DATA_TYPE_MEDIA}.
*
* @param message See {@link #getMessage()}.
* @param cause See {@link #getCause()}.
* @return The created instance.
*/
public
static
ParserException
createForMalformedContainer
(
@Nullable
String
message
,
@Nullable
Throwable
cause
)
{
return
new
ParserException
(
message
,
cause
,
/* contentIsMalformed= */
true
,
C
.
DATA_TYPE_MEDIA
);
}
/**
* Creates a new instance for which {@link #contentIsMalformed} is false and {@link #dataType} is
* {@link C#DATA_TYPE_MEDIA}.
*
* @param message See {@link #getMessage()}.
* @return The created instance.
*/
public
static
ParserException
createForUnsupportedContainerFeature
(
@Nullable
String
message
)
{
return
new
ParserException
(
message
,
/* cause= */
null
,
/* contentIsMalformed= */
false
,
C
.
DATA_TYPE_MEDIA
);
}
/**
* 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.
*/
public
final
boolean
contentIsMalformed
;
/** The {@link DataType data type} of the parsed bitstream. */
public
final
int
dataType
;
/**
* Creates a new instance.
*
* @deprecated Use a factory method which initializes {@link #contentIsMalformed}, and {@link
* #dataType} instead.
*/
@Deprecated
public
ParserException
()
{
public
ParserException
()
{
super
(
);
this
(
/* message= */
null
,
/* cause= */
null
);
}
}
/** @param message The detail message for the exception. */
/**
* Creates a new instance.
*
* @param message The detail message for the exception.
* @deprecated Use a factory method which initializes {@link #contentIsMalformed}, and {@link
* #dataType} instead.
*/
@Deprecated
public
ParserException
(
String
message
)
{
public
ParserException
(
String
message
)
{
super
(
message
);
this
(
message
,
/* cause= */
null
);
}
}
/** @param cause The cause for the exception. */
/**
* Creates a new instance.
*
* @param cause The cause for the exception.
* @deprecated Use a factory method which initializes {@link #contentIsMalformed}, and {@link
* #dataType} instead.
*/
@Deprecated
public
ParserException
(
Throwable
cause
)
{
public
ParserException
(
Throwable
cause
)
{
super
(
cause
);
this
(
/* message= */
null
,
cause
);
}
}
/**
/**
* Creates a new instance.
*
* @param message The detail message for the exception.
* @param message The detail message for the exception.
* @param cause The cause for the exception.
* @param cause The cause for the exception.
* @deprecated Use a factory method which initializes {@link #contentIsMalformed}, and {@link
* #dataType} instead.
*/
*/
public
ParserException
(
String
message
,
Throwable
cause
)
{
@Deprecated
public
ParserException
(
@Nullable
String
message
,
@Nullable
Throwable
cause
)
{
this
(
message
,
cause
,
/* contentIsMalformed= */
true
,
C
.
DATA_TYPE_UNKNOWN
);
}
private
ParserException
(
@Nullable
String
message
,
@Nullable
Throwable
cause
,
boolean
contentIsMalformed
,
@DataType
int
dataType
)
{
super
(
message
,
cause
);
super
(
message
,
cause
);
this
.
contentIsMalformed
=
contentIsMalformed
;
this
.
dataType
=
dataType
;
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment