Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.aocat.psis.client.utils
Class Utils

    java.lang.Object
      net.aocat.psis.client.utils.Utils

    public class Utils

extends java.lang.Object

Utilities class.

Author:
  aalcaide

Constructor Summary
`Utils()`

Method Summary
`static byte[]` | `getBytes(java.io.InputStream is)` Gets a byte array from an InputStream.
`static byte[]` | `getBytesFromFile(java.lang.String path)` Returns the contents of the file in a byte array.
`static byte[]` | `getBytesFromFileAbsPath(java.lang.String absPath)` Returns the contents of the file in a byte array.
`static java.security.cert.X509Certificate` | `getCertificate(java.lang.String path)` Builds a certificate from the path of the file that contains it.
`static void` | `printXmlObject(org.apache.xmlbeans.XmlObject xmlObj)` Prints an XMLObject (pretty print).
`static void` | `printXmlObject(org.apache.xmlbeans.XmlObject xmlObj, java.lang.String filePath)` Prints an XMLObject (pretty print) and saves it to disk.
`static void` | `saveToFile(byte[] data, java.lang.String fileAbsolutePath)` Saves byte[] to a file.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Utils

    public Utils()

Method Detail

### printXmlObject

    public static void printXmlObject(org.apache.xmlbeans.XmlObject xmlObj,
                                      java.lang.String filePath)

  Prints an XMLObject (pretty print) and saves it to disk.

  Parameters:
    `xmlObj` - XMLObject to print

### printXmlObject

    public static void printXmlObject(org.apache.xmlbeans.XmlObject xmlObj)

  Prints an XMLObject (pretty print).

  Parameters:
    `xmlObj` - XMLObject to print

### getCertificate

    public static java.security.cert.X509Certificate getCertificate(java.lang.String path)
                                                             throws java.security.cert.CertificateException

  Builds a certificate from the path of the file that contains it.

  Parameters:
    `path` - path of the file that contains the certificate
  Returns:
    java.security.X509Certificate
  Throws:
    `java.security.cert.CertificateException`

### getBytesFromFile

    public static byte[] getBytesFromFile(java.lang.String path)
                                   throws java.io.IOException

  Returns the contents of the file in a byte array.

  Parameters:
    `path` - path of the file relative to classpath
  Returns:
    byte[] contents of the file
  Throws:
    `java.io.IOException`

### getBytesFromFileAbsPath

    public static byte[] getBytesFromFileAbsPath(java.lang.String absPath)
                                          throws java.io.IOException

  Returns the contents of the file in a byte array.

  Parameters:
    `absPath` - absolute path of the file
  Returns:
    byte[] contents of the file
  Throws:
    `java.io.IOException`

### getBytes

    public static byte[] getBytes(java.io.InputStream is)
                           throws java.io.IOException

  Gets a byte array from an InputStream.

  Parameters:
    `is` - InputStream
  Returns:
    byte[]
  Throws:
    `java.io.IOException`

### saveToFile

    public static void saveToFile(byte[] data,
                                  java.lang.String fileAbsolutePath)
                           throws java.io.IOException

  Saves byte[] to a file.

  Parameters:
    `data` - data to save
    `fileAbsolutePath` - absolute path of the file where to save the data
  Throws:
    `java.io.IOException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD