# Class NodeUtil

java.lang.Object
uk.ac.starlink.datanode.nodes.NodeUtil

public class NodeUtil extends Object
Miscellaneous utilities.

## Constructor Summary

Constructors
Constructor
Description
`NodeUtil()`

## Method Summary

Modifier and Type
Method
Description
`static String`
`getNodePath(DataNode node)`
Returns the full path of a node, if possible.
`static boolean`
`hasAST()`
Indicates whether the JNIAST package is present.
`static boolean`
`hasGUI()`
Indicates whether applications within this JVM should be considered to be running within a graphical context or not.
`static boolean`
`hasHDS()`
Indicates whether the JNIHDS package is present.
`static boolean`
`hasJAI()`
Indicates whether the Java Advanced Imaging classes are available.
`static boolean`
`hasTAMFITS()`
Indicates whether the nom.tam.fits FITS I/O library is available.
`static boolean`
`isASCII(byte[] buf)`
Indicates whether the bytes in a given buffer look like ASCII text or not.
`static void`
`setGUI(boolean hasGUI)`
Sets whether applications running within this JVM should be considered to be running within a GUI or not.
`static String`
`toString(DataNode node)`
Returns a short string representation of a DataNode.

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### NodeUtil

public NodeUtil()

## Method Details

### isASCII

public static boolean isASCII(byte[] buf)
Indicates whether the bytes in a given buffer look like ASCII text or not. This is just a guess based on what characters are in there.

Parameters:
  `buf` - the buffer to test
Returns:
  `true` iff `buf` looks like ASCII

### hasHDS

public static boolean hasHDS()
Indicates whether the JNIHDS package is present. It might not be if the native libraries for this platform have not been installed.

Returns:
  true iff JNIDHS is availble

### hasAST

public static boolean hasAST()
Indicates whether the JNIAST package is present. It might not be if the native libraries for this platform have not been installed.

Returns:
  true iff JNIAST is available

### hasJAI

public static boolean hasJAI()
Indicates whether the Java Advanced Imaging classes are available. These are an extension to the J2SE1.4, so may not be present if they have not been installed.

Returns:
  true iff JAI is available

### hasTAMFITS

public static boolean hasTAMFITS()
Indicates whether the nom.tam.fits FITS I/O library is available.

Returns:
  true iff nom.tam.fits is available

### hasGUI

public static boolean hasGUI()
Indicates whether applications within this JVM should be considered to be running within a graphical context or not.

Returns:
  true iff this JVM appears to be using graphical components

### setGUI

public static void setGUI(boolean hasGUI)
Sets whether applications running within this JVM should be considered to be running within a GUI or not.

Parameters:
  `hasGUI` - true iff this JVM ought to be using graphical components

### getNodePath

public static String getNodePath(DataNode node)
Returns the full path of a node, if possible. The idea is to give a human-readable string indictating what you're looking at, describing position within filesystem, tar archive, XML document, whatever.

Parameters:
  `node` - node to trace
Returns:
  node path, or null

### toString

public static String toString(DataNode node)
Returns a short string representation of a DataNode. This is suitable for use as the string used in rendering the node in the tree.

Returns:
  a string summarising the node