public final class FitsUtil extends Object
Modifier and Type | Method and Description |
---|---|
static int |
addPadding(int size) |
static long |
addPadding(long size) |
static String[] |
byteArrayToStrings(byte[] bytes,
int maxLen) |
static long |
findOffset(Closeable o) |
static InputStream |
getURLStream(URL url,
int level) |
static int |
maxLength(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(Closeable o,
long offset)
Reposition a random access stream to a requested offset.
|
static byte[] |
stringsToByteArray(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 String[] byteArrayToStrings(byte[] bytes, int maxLen)
bytes
- byte array to convertmaxLen
- the max string lengthpublic static long findOffset(Closeable o)
o
- the stream to get the positionpublic static InputStream getURLStream(URL url, int level) throws IOException
url
- the url to get the stream fromlevel
- max levels of redirectionIOException
- if the operation failedpublic static int maxLength(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(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(String[] stringArray, int maxLen)
stringArray
- the array with StringsmaxLen
- the max length (in bytes) of every StringCopyright © 1996–2016 nom-tam-fits. All rights reserved.