public abstract class DapUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static BigInteger |
BIG_UMASK64 |
static String |
CEATTRNAME |
static String |
CHECKSUMATTRNAME |
static int |
CHECKSUMSIZE |
static int |
CHUNK_ALL |
static int |
CHUNK_DATA |
static int |
CHUNK_END |
static int |
CHUNK_ERROR |
static int |
CHUNK_LITTLE_ENDIAN |
static int |
CHUNK_NOCHECKSUM |
static String |
CRLF |
static int |
CRLFSIZE |
static String |
DIGESTER |
static String |
DRIVELETTERS |
static String |
LF |
static String |
LITTLEENDIANATTRNAME |
static ByteOrder |
NATIVE_ORDER |
static ByteOrder |
NETWORK_ORDER |
static Charset |
UTF8 |
| Constructor and Description |
|---|
DapUtil() |
| Modifier and Type | Method and Description |
|---|---|
static String |
absolutize(String path) |
static List<String> |
backslashSplit(String s,
char sep)
Split a string with respect to a separator
character and taking backslashes into consideration.
|
static String |
canonFileURL(String url) |
static String |
canonicalpath(String path)
Convert path to:
1.
|
static String |
canonjoin(String prefix,
String suffix) |
static boolean |
checkFixedSize(DapVariable var) |
static void |
checkruntime(Exception e)
Re-throw run-time exceptions
|
static String |
denullify(String path)
Convert null paths to ""
|
static long |
dimProduct(List<DapDimension> dimset) |
static List<Slice> |
dimsetToSlices(List<DapDimension> dimset) |
static byte[] |
extract(ByteBuffer buf)
Properly extract the byte contents of a ByteBuffer
|
static String |
fqnPrefix(String fqn) |
static String |
fqnSuffix(String fqn) |
static long[] |
getDimSizes(List<DapDimension> dims) |
static List<String> |
getProtocols(String url,
int[] breakpoint)
Return the set of leading protocols for a url; may be more than one.
|
static List<DapVariable> |
getStructurePath(DapVariable var)
Given a dap variable, get the path from the
top-level variable to and including the given variable
such that all but the last element is a structure.
|
static boolean |
hasDriveLetter(String path)
return true if this path appears to start with a windows drive letter
|
static boolean |
hasSequence(DapNode node) |
static boolean |
hasStrideOne(List<Slice> slices) |
static boolean |
hasWindowsDrive(String path) |
static List<Slice> |
indexToSlices(Index indices)
Given an offset (single index) and a set of dimensions
compute the set of dimension indices that correspond
to the offset.
|
static List<Slice> |
indexToSlices(Index indices,
DapVariable template)
Provide a helper function to convert an Index object to
a slice list.
|
static List<Slice> |
indexToSlices(Index indices,
List<DapDimension> dimset) |
static boolean |
isAbsolutePath(String path) |
static boolean |
isContiguous(List<Slice> slices)
Test if a set of slices represent a contiguous region
This is equivalent to saying all strides are one
|
static boolean |
isScalarSlices(List<Slice> slices) |
static boolean |
isSinglePoint(List<Slice> slices)
Test if a set of slices represent a single position
|
static boolean |
isWhole(List<Slice> slices,
List<DapDimension> dimset)
Test a List
|
static String |
join(String[] array,
String sep,
int from,
int upto)
Given an Array of Strings and a separator and a count,
concat the first count elements of an array with separator
between them.
|
static String |
locateFile(String filename,
String abspath,
boolean wantdir)
Walk the specified subtree dir tree to try to locate file|dir named filename.
|
static String |
locateRelative(String relpath,
String abspath,
boolean wantdir)
Walk the specified dir tree to locate file specified by relative path.
|
static String |
merge(String[] pieces,
String sep) |
static String |
nullify(String path)
Convert "" paths to null
|
static Index |
offsetToIndex(long offset,
long[] dimsizes)
Given an offset (single index) and a set of dimensions
compute the set of dimension indices that correspond
to the offset.
|
static List<Slice> |
offsetToSlices(long offset,
DapVariable template)
Provide a helper function to convert an offset to
a slice list.
|
static byte[] |
readbinaryfile(InputStream stream) |
static String |
readtextfile(InputStream stream) |
static String |
relativize(String path) |
static long |
sliceProduct(List<Slice> slices) |
static Index |
slicesToIndex(List<Slice> slices)
If a set of slices refers to a single position,
then return the corresponding Index.
|
static Integer |
stringToInteger(String s) |
static String |
xrelpath(String path)
Relativizing a path => remove any leading '/' and cleaning it
|
public static final BigInteger BIG_UMASK64
public static final Charset UTF8
public static final ByteOrder NETWORK_ORDER
public static final ByteOrder NATIVE_ORDER
public static final int CHUNK_DATA
public static final int CHUNK_END
public static final int CHUNK_ERROR
public static final int CHUNK_LITTLE_ENDIAN
public static final int CHUNK_NOCHECKSUM
public static final int CHUNK_ALL
public static final String LF
public static final String CRLF
public static final int CRLFSIZE
public static final int CHECKSUMSIZE
public static final String DIGESTER
public static final String CHECKSUMATTRNAME
public static final String LITTLEENDIANATTRNAME
public static final String CEATTRNAME
public static final String DRIVELETTERS
public static List<String> backslashSplit(String s, char sep)
s - The string to splitsep - The character on which to splitpublic static boolean hasSequence(DapNode node)
public static String locateFile(String filename, String abspath, boolean wantdir)
filename - Name of the file|dir to locateabspath - Absolute path from which to start searchwantdir - True if we are looking for a directory,
false if we are looking for a filepublic static String locateRelative(String relpath, String abspath, boolean wantdir)
relpath - Name of the file|dir to locateabspath - Absolute path from which to start searchwantdir - True if we are looking for a directory,
false if we are looking for a filepublic static String canonicalpath(String path)
path - convert this pathpublic static boolean checkFixedSize(DapVariable var)
public static byte[] extract(ByteBuffer buf)
buf - The buffer whose content is to be extracted
as defined by the buffer limit.public static byte[] readbinaryfile(InputStream stream) throws IOException
IOExceptionpublic static String readtextfile(InputStream stream) throws IOException
IOExceptionpublic static List<DapVariable> getStructurePath(DapVariable var)
public static String denullify(String path)
path - public static String nullify(String path)
path - public static long[] getDimSizes(List<DapDimension> dims)
public static long dimProduct(List<DapDimension> dimset)
public static boolean isWhole(List<Slice> slices, List<DapDimension> dimset)
slices - the set of slicesdimset - the list of DapDimensionpublic static String join(String[] array, String sep, int from, int upto)
array - the array to concatsep - the separatorfrom - start point for join (inclusive)upto - end point for join (exclusive)public static String xrelpath(String path)
path - public static boolean hasDriveLetter(String path)
path - public static List<String> getProtocols(String url, int[] breakpoint)
url - the url whose protocols to returnbreakpoint - return the index past last protocolpublic static void checkruntime(Exception e)
public static boolean hasWindowsDrive(String path)
public static boolean isAbsolutePath(String path)
public static List<Slice> indexToSlices(Index indices, DapVariable template) throws DapException
indices - indicate value to readtemplate - variable templateDapExceptionpublic static List<Slice> indexToSlices(Index indices, List<DapDimension> dimset) throws DapException
DapExceptionpublic static List<Slice> offsetToSlices(long offset, DapVariable template) throws DapException
offset - offsettemplate - variable templateDapExceptionpublic static Index offsetToIndex(long offset, long[] dimsizes)
public static List<Slice> indexToSlices(Index indices) throws DapException
DapExceptionpublic static boolean isContiguous(List<Slice> slices)
slices - public static boolean isSinglePoint(List<Slice> slices)
slices - public static Index slicesToIndex(List<Slice> slices) throws DapException
slices - DapExceptionpublic static List<Slice> dimsetToSlices(List<DapDimension> dimset) throws DapException
DapException