Note
This page has been updated for jDataView 3
jDataView supports additional Char
, String
and Bytes
types.
String
operations all support 'binary'
(by default) and 'utf-8'
encodings. Additionally, getString
supports all the encodings supported by TextDecoder](https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder/encoding).
Char
is always encoded as one-byte 'binary'
.
The setter methods for Bytes
will accept any ArrayLike<number>
, but the getter method will always return a Uint8Array
of bytes.
See writeXXX methods to understand the write
variants of the set
methods.
// Read a string using the specified encoding, or binary if unspecified view.getString(byteLength: number, byteOffset: number | undefined, encoding = 'binary'): string // Set a string using the specified encoding, or binary if unspecified view.setString(byteOffset: number | undefined, str: string, encoding = 'binary'): void view.writeString(str: string, encoding = 'binary'): void // Get a single character. This is the same as getting a 1-length string using binary encoding view.getChar(byteOffset: number | undefined): string // Set a single character. This is the same as setting a 1-length string using binary encoding view.setChar(byteOffset: number | undefined, char: string): void view.writeChar(char: string): void // Get raw bytes. If length is undefined, it will go to the end of the buffer. view.getBytes(length: number, byteOffset: number | undefined, littleEndian = true, toArray = false): Uint8Array // Directly set raw bytes view.setBytes(byteOffset: number | undefined, bytes: ArrayLike<number>, littleEndian = true): void view.writeBytes(bytes: ArrayLike<number>, littleEndian = true): void
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4