Package writer2latex.util

# Class Misc

java.lang.Object
writer2latex.util.Misc

public class Misc extends Object

## Constructor Summary

Constructors
Constructor
Description
`Misc()`

## Method Summary

Modifier and Type
Method
Description
`static final String`
`dateOnly(String sDate)`
`static final int[]`
`doubleIntArray(int[] array)`
`static final String`
`formatDate(String sDate, String sLanguage, String sCountry)`
`static final String`
`getAttribute(Element node, String attribute)`
`static final String`
`getAttribute(Node node, String attribute)`
`static final Element`
`getChildByTagName(Node node, String sTagName)`
`static final String`
`getFileExtension(String sURL)`
Get the file extension from an URL
`static final String`
`getFileName(String sURL)`
Get the file name part of an URL
`static final Element`
`getFirstChildElement(Node node)`
`static final int`
`getIntegerFromHex(String sHex, int nDefault)`
`static final String`
`getPath(String sURL)`
Get the path part of an URL
`static String`
`getPCDATA(Node node)`
`static final int`
`getPosInteger(String sInteger, int nDefault)`
`static byte[]`
`inputStreamToByteArray(InputStream is)`
Read an `InputStream` into a `byte`array
`static final String`
`int2alph(int number, boolean bLetterSync)`
`static final String`
`int2Alph(int number, boolean bLetterSync)`
`static final String`
`int2arabic(int number)`
`static final String`
`int2roman(int number)`
`static final String`
`int2Roman(int number)`
`static final boolean`
`isElement(Node node)`
`static final boolean`
`isElement(Node node, String sTagName)`
`static final boolean`
`isText(Node node)`
`static String`
`makeFileName(String sURL)`
`static String`
`makeHref(String s)`
`static String`
`makeTeXFriendly(String sFileName, String sDefault)`
Make a file name TeX friendly, replacing offending characters
`static final String`
`removeExtension(String sURL)`
`static String[]`
`sortStringSet(Set<String> theSet)`
`static final String`
`trimDocumentName(String name, String extension)`
`static String`
`urlDecode(String s)`
`static String`
`urlEncode(String s)`
`static File`
`urlToFile(String sUrl)`

### Methods inherited from class java.lang.Object

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

## Constructor Details

### Misc

public Misc()

## Method Details

### doubleIntArray

public static final int[] doubleIntArray(int[] array)

### dateOnly

public static final String dateOnly(String sDate)

### formatDate

public static final String formatDate(String sDate, String sLanguage, String sCountry)

### int2roman

public static final String int2roman(int number)

### int2Roman

public static final String int2Roman(int number)

### int2arabic

public static final String int2arabic(int number)

### int2alph

public static final String int2alph(int number, boolean bLetterSync)

### int2Alph

public static final String int2Alph(int number, boolean bLetterSync)

### getIntegerFromHex

public static final int getIntegerFromHex(String sHex, int nDefault)

### makeTeXFriendly

public static String makeTeXFriendly(String sFileName, String sDefault)
Make a file name TeX friendly, replacing offending characters

Parameters:
  `sFileName` - the file name
  `sDefault` - a default name to use if no characters remains after filtering
Returns:
  the modified file name

### trimDocumentName

public static final String trimDocumentName(String name, String extension)

### getPath

public static final String getPath(String sURL)
Get the path part of an URL

Parameters:
  `sURL` - the URL from which the filename should be extracted
Returns:
  the file name

### getFileName

public static final String getFileName(String sURL)
Get the file name part of an URL

Parameters:
  `sURL` - the URL from which the filename should be extracted
Returns:
  the file name

### getFileExtension

public static final String getFileExtension(String sURL)
Get the file extension from an URL

Parameters:
  `sURL` -
Returns:
  the file extension (including dot) or the empty string if there is no file extension

### removeExtension

public static final String removeExtension(String sURL)

### getAttribute

public static final String getAttribute(Node node, String attribute)

### isElement

public static final boolean isElement(Node node)

### isElement

public static final boolean isElement(Node node, String sTagName)

### isText

public static final boolean isText(Node node)

### getAttribute

public static final String getAttribute(Element node, String attribute)

### getChildByTagName

public static final Element getChildByTagName(Node node, String sTagName)

### getFirstChildElement

public static final Element getFirstChildElement(Node node)

### getPCDATA

public static String getPCDATA(Node node)

### sortStringSet

public static String[] sortStringSet(Set<String> theSet)

### urlEncode

public static String urlEncode(String s)

### urlDecode

public static String urlDecode(String s)

### makeHref

public static String makeHref(String s)

### makeFileName

public static String makeFileName(String sURL)

### urlToFile

public static File urlToFile(String sUrl)

### inputStreamToByteArray

public static byte[] inputStreamToByteArray(InputStream is) throws IOException

Read an `InputStream` into a `byte`array

Parameters:
  `is` - the `InputStream` to read
Returns:
  a byte array with the contents read from the stream
Throws:
  `IOException` - in case of any I/O errors.

### getPosInteger

public static final int getPosInteger(String sInteger, int nDefault)