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
274743cd
authored
Feb 18, 2020
by
Pierre-Hugues Husson
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
[ParsableBitArray] Add readString
parent
98de7c46
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
library/common/src/main/java/com/google/android/exoplayer2/util/ParsableBitArray.java
library/common/src/main/java/com/google/android/exoplayer2/util/ParsableBitArray.java
View file @
274743cd
...
...
@@ -15,6 +15,8 @@
*/
package
com
.
google
.
android
.
exoplayer2
.
util
;
import
java.nio.charset.Charset
;
/**
* Wraps a byte array, providing methods that allow it to be read as a bitstream.
*/
...
...
@@ -320,4 +322,16 @@ public final class ParsableBitArray {
&&
(
byteOffset
<
byteLimit
||
(
byteOffset
==
byteLimit
&&
bitOffset
==
0
)));
}
/**
* Reads the next {@code length} bytes as characters in the specified {@link Charset}.
*
* @param length The number of bytes to read.
* @param charset The character set of the encoded characters.
* @return The string encoded by the bytes in the specified character set.
*/
public
String
readString
(
int
length
,
Charset
charset
)
{
byte
[]
buf
=
new
byte
[
length
];
readBytes
(
buf
,
0
,
length
);
return
new
String
(
buf
,
charset
);
}
}
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