public final class Explorer extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
DEVICE |
static String |
UNKNOWN |
| Constructor and Description |
|---|
Explorer(DatasetProvider provider) |
| Modifier and Type | Method and Description |
|---|---|
Map<String,Object> |
browse(String path,
boolean hidden)
Explores the path provided on the filesystem.
|
org.apache.twill.filesystem.Location |
getLocation(String path)
Trick, to extract the URI for a location.
|
BoundedLineInputStream |
read(String path,
Charset encoding,
int lines)
This methods provides an efficiently way to read a file from the file system specified by
the
Location.. |
byte[] |
read(String path,
int size)
Reads the 'size' bytes from the file.
|
BoundedLineInputStream |
read(String path,
String encoding,
int lines) |
public static final String DEVICE
public static final String UNKNOWN
public Explorer(DatasetProvider provider)
public Map<String,Object> browse(String path, boolean hidden) throws ExplorerException
path - to be explored.ExplorerException - thrown when there is issue browsing directory.public BoundedLineInputStream read(String path, Charset encoding, int lines) throws ExplorerException, IOException
Location.. It uses a bounded line stream that limits the lines being read
from the BufferedInputStream.path - Specifies the path to file to be read. Assumes the file exists at the path specified.encoding - Specifies the encoding of the file.lines - Number of lines to be read from the file.BoundedLineInputStreamExplorerExceptionIOExceptionpublic BoundedLineInputStream read(String path, String encoding, int lines) throws ExplorerException, IOException
ExplorerExceptionIOExceptionpublic byte[] read(String path, int size) throws ExplorerException, IOException
path - to the file being read.size - specifies the bytes to be read.ExplorerExceptionIOExceptionpublic org.apache.twill.filesystem.Location getLocation(String path) throws ExplorerException
path - to a Dataset.URISyntaxException - issue constructing the URI.ExplorerExceptionCopyright © 2023 CDAP Licensed under the Apache License, Version 2.0.