public final class FitsUtil
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static int |
addPadding(int size) |
static long |
addPadding(long size) |
static java.lang.String[] |
byteArrayToStrings(byte[] bytes,
int maxLen) |
static long |
findOffset(java.io.Closeable o) |
static java.io.InputStream |
getURLStream(java.net.URL url,
int level) |
static int |
maxLength(java.lang.String[] strings) |
static void |
pad(ArrayDataOutput stream,
long size)
Add padding to an output stream.
|
static void |
pad(ArrayDataOutput stream,
long size,
byte fill)
Add padding to an output stream.
|
static int |
padding(int size) |
static int |
padding(long size) |
static void |
reposition(java.io.Closeable o,
long offset)
Reposition a random access stream to a requested offset.
|
static byte[] |
stringsToByteArray(java.lang.String[] stringArray,
int maxLen)
Convert an array of Strings to bytes.
|
public static int addPadding(int size)
size - the current size.public static long addPadding(long size)
size - the current size.public static java.lang.String[] byteArrayToStrings(byte[] bytes,
int maxLen)
bytes - byte array to convertmaxLen - the max string lengthpublic static long findOffset(java.io.Closeable o)
o - the stream to get the positionpublic static java.io.InputStream getURLStream(java.net.URL url,
int level)
throws java.io.IOException
url - the url to get the stream fromlevel - max levels of redirectionjava.io.IOException - if the operation failedpublic static int maxLength(java.lang.String[] strings)
throws FitsException
strings - array of strings to checkFitsException - if the operation failedpublic static void pad(ArrayDataOutput stream, long size) throws FitsException
stream - stream to padsize - the current sizeFitsException - if the operation failedpublic static void pad(ArrayDataOutput stream, long size, byte fill) throws FitsException
stream - stream to padsize - the current sizefill - the fill byte to useFitsException - if the operation failedpublic static int padding(int size)
size - the size without paddingpublic static int padding(long size)
public static void reposition(java.io.Closeable o,
long offset)
throws FitsException
o - the closable to repositionoffset - the offset to position it to.FitsException - if the operation was failed or not possiblepublic static byte[] stringsToByteArray(java.lang.String[] stringArray,
int maxLen)
stringArray - the array with StringsmaxLen - the max length (in bytes) of every String