public class IonStreamUtils
extends java.lang.Object
Constructor and Description |
---|
IonStreamUtils() |
Modifier and Type | Method and Description |
---|---|
static boolean |
isGzip(byte[] buffer,
int offset,
int length)
Determines whether a buffer contains GZIPped data.
|
static boolean |
isIonBinary(byte[] buffer)
Determines whether a buffer contains Ion binary data by looking for the
presence of the Ion Version Marker at its start.
|
static boolean |
isIonBinary(byte[] buffer,
int offset,
int length)
Determines whether a buffer contains Ion binary data by looking for the
presence of the Ion Version Marker at a given offset.
|
static void |
throwAsIonException(java.lang.Exception e)
Wraps the given Exception with IonException and throws.
|
static java.io.InputStream |
unGzip(java.io.InputStream in)
Returns a stream that decompresses a stream if it contains GZIPped data,
otherwise has no effect on the stream (but may wrap it).
|
static void |
writeBoolList(IonWriter writer,
boolean[] values)
writes an IonList with a series of IonBool values.
|
static void |
writeFloatList(IonWriter writer,
double[] values)
writes an IonList with a series of IonFloat values.
|
static void |
writeFloatList(IonWriter writer,
float[] values)
writes an IonList with a series of IonFloat values.
|
static void |
writeIntList(IonWriter writer,
byte[] values)
writes an IonList with a series of IonInt values.
|
static void |
writeIntList(IonWriter writer,
int[] values)
writes an IonList with a series of IonInt values.
|
static void |
writeIntList(IonWriter writer,
long[] values)
writes an IonList with a series of IonInt values.
|
static void |
writeIntList(IonWriter writer,
short[] values)
writes an IonList with a series of IonInt values.
|
static void |
writeStringList(IonWriter writer,
java.lang.String[] values)
writes an IonList with a series of IonString values.
|
public static boolean isIonBinary(byte[] buffer)
false
result does not imply that the buffer has Ion text,
just that it's not Ion binary.buffer
- the data to check.true
if the buffer contains Ion binary (starting from
offset zero); false
if the buffer is null or too short.isIonBinary(byte[], int, int)
public static boolean isIonBinary(byte[] buffer, int offset, int length)
false
result does not imply that the buffer has Ion text,
just that it's not Ion binary.buffer
- the data to check.offset
- the position in the buffer at which to start reading.length
- the number of bytes in the buffer that are valid,
starting from offset
.true
if the buffer contains Ion binary (starting from
offset
); false
if the buffer is null or if the
length
is too short.isIonBinary(byte[])
public static boolean isGzip(byte[] buffer, int offset, int length)
buffer
- the data to check.offset
- the position in the buffer at which to start reading.length
- the number of bytes in the buffer that are valid,
starting from offset
.true
if the buffer contains GZIPped data; false
if the buffer is null or if the length
is too short.public static java.io.InputStream unGzip(java.io.InputStream in) throws java.io.IOException
java.io.IOException
public static void throwAsIonException(java.lang.Exception e)
e
- the exception to wrap.public static void writeBoolList(IonWriter writer, boolean[] values) throws java.io.IOException
values
- boolean values to populate the list withjava.io.IOException
public static void writeFloatList(IonWriter writer, float[] values) throws java.io.IOException
values
- 32 bit float values to populate the lists IonFloat's withjava.io.IOException
public static void writeFloatList(IonWriter writer, double[] values) throws java.io.IOException
values
- 64 bit float values to populate the lists IonFloat's withjava.io.IOException
public static void writeIntList(IonWriter writer, byte[] values) throws java.io.IOException
values
- signed byte values to populate the lists int's withjava.io.IOException
public static void writeIntList(IonWriter writer, short[] values) throws java.io.IOException
values
- signed short values to populate the lists int's withjava.io.IOException
public static void writeIntList(IonWriter writer, int[] values) throws java.io.IOException
values
- signed int values to populate the lists int's withjava.io.IOException
public static void writeIntList(IonWriter writer, long[] values) throws java.io.IOException
values
- signed long values to populate the lists int's withjava.io.IOException
public static void writeStringList(IonWriter writer, java.lang.String[] values) throws java.io.IOException
values
- Java String to populate the lists IonString's fromjava.io.IOException