uk.ac.starlink.xdoc
Class XdocUtils

java.lang.Object
  extended by uk.ac.starlink.xdoc.XdocUtils

public class XdocUtils
extends Object

Utilities designed for use during XSTL processing. These generally provide some kind of processing based on the values of strings which return strings for insertion into a document. They can be used in conjunction with Xalan's XSLT processing by adding the attribute

    xmlns:XdocUtils="xalan://uk.ac.starlink.xdoc.XdocUtils"
 
to the xsl:stylesheet element of an XSLT stylesheet. Other processors probably have their own mechanisms.

Since:
20 Feb 2006
Author:
Mark Taylor

Method Summary
static String classUsage(String clazzName)
          Returns the usage string for a given class.
static String reportFileSize(String loc)
          Returns the approximate size of a file in human-readable form given the location of a file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

classUsage

public static String classUsage(String clazzName)
                         throws ClassNotFoundException,
                                NoSuchMethodException,
                                IllegalAccessException,
                                InvocationTargetException
Returns the usage string for a given class. It invokes the main(String[]) method of the named class with the single argument "-help", and captures and returns the output.

Parameters:
clazzName - fully qualified name of class having main() method
Returns:
usage string
Throws:
ClassNotFoundException
NoSuchMethodException
IllegalAccessException
InvocationTargetException

reportFileSize

public static String reportFileSize(String loc)
Returns the approximate size of a file in human-readable form given the location of a file.

Parameters:
loc - file location
Returns:
file file length string, such as "5.6M"


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.