public abstract class DapUtil extends Object
Modifier and Type | Field and Description |
---|---|
static 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 String |
CRLF |
static int |
CRLFSIZE |
static String |
DIGESTER |
static String |
DRIVELETTERS |
static String |
LF |
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 |
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> |
dimsetSlices(List<DapDimension> dimset)
Given a view, get the universal
View either from a DapDataset.
|
static byte[] |
extract(ByteBuffer buf)
Properly extract the byte contents of a ByteBuffer
|
static String |
fqnPrefix(String fqn) |
static String |
fqnSuffix(String fqn) |
static List<String> |
getProtocols(String url)
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 |
isContiguous(List<Slice> slices) |
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 byte[] |
readbinaryfile(InputStream stream) |
static String |
readtextfile(InputStream stream) |
static String |
relativize(String path) |
static long |
sliceProduct(List<Slice> slices) |
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_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 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
IOException
public static String readtextfile(InputStream stream) throws IOException
IOException
public static List<DapVariable> getStructurePath(DapVariable var)
public static String denullify(String path)
path
- public static String nullify(String path)
path
- public static long dimProduct(List<DapDimension> dimset)
public static List<Slice> dimsetSlices(List<DapDimension> dimset) throws DapException
DapException
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)
url
- the url whose protocols to returnpublic static void checkruntime(Exception e)
Copyright © 1999–2016 UCAR/Unidata. All rights reserved.