File I/O utilities.
static byte[] | |
static List<String> |
loadLabels(Context context, String filePath)
Loads labels from the label file into a list of strings.
|
static List<String> | |
static List<String> |
loadLabels(InputStream inputStream, Charset cs)
Loads labels from an input stream of an opened label file.
|
static List<String> |
loadLabels(Context context, String filePath, Charset cs)
Loads labels from the label file into a list of strings.
|
static MappedByteBuffer |
loadMappedFile(Context context, String filePath)
Loads a file from the asset folder through memory mapping.
|
static List<String> |
loadSingleColumnTextFile(Context context, String filePath, Charset cs)
Loads a vocabulary file (a single-column text file) into a list of strings.
|
static List<String> |
loadSingleColumnTextFile(InputStream inputStream, Charset cs)
Loads vocabulary from an input stream of an opened vocabulary file (which is a single-column
text file).
|
Loads a binary file from the asset folder.
context | Application context to access assets. |
---|---|
filePath | Asset path of the file. |
IOException | if an I/O error occurs when loading file. |
---|
Loads labels from the label file into a list of strings.
A legal label file is the plain text file whose contents are split into lines, and each line is an individual value. The file should be in assets of the context.
context | The context holds assets. |
---|---|
filePath | The path of the label file, relative with assets directory. |
IOException | if error occurs to open or read the file. |
---|
Loads labels from an input stream of an opened label file. See details for label files in
loadLabels(Context, String)
.
inputStream | the input stream of an opened label file. |
---|
IOException | if error occurs to open or read the file. |
---|
Loads labels from an input stream of an opened label file. See details for label files in
loadLabels(Context, String)
.
inputStream | the input stream of an opened label file. |
---|---|
cs | Charset to use when decoding content of label file. |
IOException | if error occurs to open or read the file. |
---|
Loads labels from the label file into a list of strings.
A legal label file is the plain text file whose contents are split into lines, and each line is an individual value. The empty lines will be ignored. The file should be in assets of the context.
context | The context holds assets. |
---|---|
filePath | The path of the label file, relative with assets directory. |
cs | Charset to use when decoding content of label file. |
IOException | if error occurs to open or read the file. |
---|
Loads a file from the asset folder through memory mapping.
context | Application context to access assets. |
---|---|
filePath | Asset path of the file. |
IOException | if an I/O error occurs when loading the tflite model. |
---|
Loads a vocabulary file (a single-column text file) into a list of strings.
A vocabulary file is a single-column plain text file whose contents are split into lines, and each line is an individual value. The file should be in assets of the context.
context | The context holds assets. |
---|---|
filePath | The path of the vocabulary file, relative with assets directory. |
cs |
IOException | if error occurs to open or read the file. |
---|
Loads vocabulary from an input stream of an opened vocabulary file (which is a single-column text file).
A vocabulary file is a single-column plain text file whose contents are split into lines, and each line is an individual value. The file should be in assets of the context.
inputStream | the input stream of an opened vocabulary file. |
---|---|
cs |
IOException | if error occurs to open or read the file. |
---|