public abstract class DapUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.math.BigInteger |
BIG_UMASK64 |
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 java.lang.String |
CRLF |
static int |
CRLFSIZE |
static java.lang.String |
DIGESTER |
static java.lang.String |
DRIVELETTERS |
static java.lang.String |
LF |
static java.nio.ByteOrder |
NATIVE_ORDER |
static java.nio.ByteOrder |
NETWORK_ORDER |
static java.nio.charset.Charset |
UTF8 |
Constructor and Description |
---|
DapUtil() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
absolutize(java.lang.String path) |
static java.util.List<java.lang.String> |
backslashSplit(java.lang.String s,
char sep)
Split a string with respect to a separator
character and taking backslashes into consideration.
|
static java.lang.String |
canonicalpath(java.lang.String path)
Convert path to:
1.
|
static java.lang.String |
canonjoin(java.lang.String prefix,
java.lang.String suffix) |
static boolean |
checkFixedSize(DapVariable var) |
static void |
checkruntime(java.lang.Exception e)
Re-throw run-time exceptions
|
static java.lang.String |
denullify(java.lang.String path)
Convert null paths to ""
|
static long |
dimProduct(java.util.List<DapDimension> dimset) |
static java.util.List<Slice> |
dimsetSlices(java.util.List<DapDimension> dimset)
Given a view, get the universal
View either from a DapDataset.
|
static byte[] |
extract(java.nio.ByteBuffer buf)
Properly extract the byte contents of a ByteBuffer
|
static java.lang.String |
fqnPrefix(java.lang.String fqn) |
static java.lang.String |
fqnSuffix(java.lang.String fqn) |
static java.util.List<java.lang.String> |
getProtocols(java.lang.String url)
Return the set of leading protocols for a url; may be more than one.
|
static java.util.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(java.lang.String path)
return true if this path appears to start with a windows drive letter
|
static boolean |
hasSequence(DapNode node) |
static boolean |
hasStrideOne(java.util.List<Slice> slices) |
static boolean |
isContiguous(java.util.List<Slice> slices) |
static boolean |
isWhole(java.util.List<Slice> slices,
java.util.List<DapDimension> dimset)
Test a List
|
static java.lang.String |
join(java.lang.String[] array,
java.lang.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 java.lang.String |
locateFile(java.lang.String filename,
java.lang.String abspath,
boolean wantdir)
Walk the specified subtree dir tree to try to locate file|dir named filename.
|
static java.lang.String |
locateRelative(java.lang.String relpath,
java.lang.String abspath,
boolean wantdir)
Walk the specified dir tree to locate file specified by relative path.
|
static java.lang.String |
merge(java.lang.String[] pieces,
java.lang.String sep) |
static java.lang.String |
nullify(java.lang.String path)
Convert "" paths to null
|
static byte[] |
readbinaryfile(java.io.InputStream stream) |
static java.lang.String |
readtextfile(java.io.InputStream stream) |
static java.lang.String |
relativize(java.lang.String path) |
static long |
sliceProduct(java.util.List<Slice> slices) |
static java.lang.String |
xrelpath(java.lang.String path)
Relativizing a path => remove any leading '/' and cleaning it
|
public static final java.math.BigInteger BIG_UMASK64
public static final java.nio.charset.Charset UTF8
public static final java.nio.ByteOrder NETWORK_ORDER
public static final java.nio.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_ALL
public static final java.lang.String LF
public static final java.lang.String CRLF
public static final int CRLFSIZE
public static final int CHECKSUMSIZE
public static final java.lang.String DIGESTER
public static final java.lang.String DRIVELETTERS
public static java.lang.String fqnSuffix(java.lang.String fqn)
public static java.lang.String fqnPrefix(java.lang.String fqn)
public static java.util.List<java.lang.String> backslashSplit(java.lang.String s, char sep)
s
- The string to splitsep
- The character on which to splitpublic static boolean hasSequence(DapNode node)
public static java.lang.String locateFile(java.lang.String filename, java.lang.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 java.lang.String locateRelative(java.lang.String relpath, java.lang.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 java.lang.String canonicalpath(java.lang.String path)
path
- convert this pathpublic static java.lang.String relativize(java.lang.String path)
public static java.lang.String absolutize(java.lang.String path)
public static boolean checkFixedSize(DapVariable var)
public static byte[] extract(java.nio.ByteBuffer buf)
buf
- The buffer whose content is to be extracted
as defined by the buffer limit.public static byte[] readbinaryfile(java.io.InputStream stream) throws java.io.IOException
java.io.IOException
public static java.lang.String readtextfile(java.io.InputStream stream) throws java.io.IOException
java.io.IOException
public static java.util.List<DapVariable> getStructurePath(DapVariable var)
public static java.lang.String denullify(java.lang.String path)
path
- public static java.lang.String nullify(java.lang.String path)
path
- public static long dimProduct(java.util.List<DapDimension> dimset)
public static java.util.List<Slice> dimsetSlices(java.util.List<DapDimension> dimset) throws DapException
DapException
public static boolean isWhole(java.util.List<Slice> slices, java.util.List<DapDimension> dimset)
slices
- the set of slicesdimset
- the list of DapDimensionpublic static long sliceProduct(java.util.List<Slice> slices)
public static boolean hasStrideOne(java.util.List<Slice> slices)
public static java.lang.String join(java.lang.String[] array, java.lang.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 java.lang.String xrelpath(java.lang.String path)
path
- public static boolean hasDriveLetter(java.lang.String path)
path
- public static java.util.List<java.lang.String> getProtocols(java.lang.String url)
url
- the url whose protocols to returnpublic static java.lang.String merge(java.lang.String[] pieces, java.lang.String sep)
public static boolean isContiguous(java.util.List<Slice> slices)
public static void checkruntime(java.lang.Exception e)
public static java.lang.String canonjoin(java.lang.String prefix, java.lang.String suffix)