nom.tam.fits
Class FitsUtil

java.lang.Object
  extended by nom.tam.fits.FitsUtil

public class FitsUtil
extends java.lang.Object

This class comprises static utility functions used throughout the FITS classes.


Constructor Summary
FitsUtil()
           
 
Method Summary
static int addPadding(int size)
          Total size of blocked FITS element
static java.lang.String[] byteArrayToStrings(byte[] o, int maxLen)
          Convert bytes to Strings
static long findOffset(java.lang.Object o)
          Find out where we are in a random access file
static java.io.InputStream getURLStream(java.net.URL url, int level)
          Get a stream to a URL accommodating possible redirections.
static boolean isCompressed(java.lang.String filename)
          Check if a file seems to be compressed.
static int maxLength(java.lang.String[] o)
          Get the maximum length of a String in a String array.
static int padding(int size)
          How many bytes are needed to fill the last 2880 block?
static void reposition(java.lang.Object o, long offset)
          Reposition a random access stream to a requested offset
static byte[] stringsToByteArray(java.lang.String[] o, int maxLen)
          Copy an array of Strings to bytes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FitsUtil

public FitsUtil()
Method Detail

reposition

public static void reposition(java.lang.Object o,
                              long offset)
                       throws FitsException
Reposition a random access stream to a requested offset

Throws:
FitsException

findOffset

public static long findOffset(java.lang.Object o)
Find out where we are in a random access file


padding

public static int padding(int size)
How many bytes are needed to fill the last 2880 block?


addPadding

public static int addPadding(int size)
Total size of blocked FITS element


isCompressed

public static boolean isCompressed(java.lang.String filename)
Check if a file seems to be compressed.


maxLength

public static int maxLength(java.lang.String[] o)
                     throws FitsException
Get the maximum length of a String in a String array.

Throws:
FitsException

stringsToByteArray

public static byte[] stringsToByteArray(java.lang.String[] o,
                                        int maxLen)
Copy an array of Strings to bytes.


byteArrayToStrings

public static java.lang.String[] byteArrayToStrings(byte[] o,
                                                    int maxLen)
Convert bytes to Strings


getURLStream

public static java.io.InputStream getURLStream(java.net.URL url,
                                               int level)
                                        throws java.io.IOException
Get a stream to a URL accommodating possible redirections. Note that if a redirection request points to a different protocol than the original request, then the redirection is not handled automatically.

Throws:
java.io.IOException