Class ElementSniffer
java.lang.Object
org.phenopackets.phenopackettools.util.format.ElementSniffer
Make an educated guess regarding which top-level element of Phenopacket schema is represented in the provided
byte[]
or InputStream
.-
Method Summary
Modifier and TypeMethodDescriptionstatic PhenopacketElement
sniff
(byte[] payload, PhenopacketFormat format) Make an educated guess ofPhenopacketElement
based on givenpayload
.static PhenopacketElement
sniff
(byte[] payload, PhenopacketSchemaVersion schemaVersion, PhenopacketFormat format) Deprecated.static PhenopacketElement
sniff
(InputStream input, PhenopacketFormat format) Make an educated guess ofPhenopacketElement
present in giveninput
.static PhenopacketElement
sniff
(InputStream input, PhenopacketSchemaVersion schemaVersion, PhenopacketFormat format) Deprecated.in favor ofsniff(InputStream, PhenopacketFormat)
.
-
Method Details
-
sniff
public static PhenopacketElement sniff(InputStream input, PhenopacketSchemaVersion schemaVersion, PhenopacketFormat format) throws IOException, SniffException Deprecated.in favor ofsniff(InputStream, PhenopacketFormat)
.Make an educated guess ofPhenopacketElement
present in giveninput
.- Parameters:
input
- anInputStream
that supportsInputStream.mark(int)
.format
- thepayload
format- Returns:
- the sniffed
PhenopacketElement
. - Throws:
IOException
- in case an error occurs while reading theinput
.SniffException
- if there are not enough bytes available in theinput
of if theinput
does not supportInputStream.mark(int)
.
-
sniff
public static PhenopacketElement sniff(InputStream input, PhenopacketFormat format) throws IOException, SniffException Make an educated guess ofPhenopacketElement
present in giveninput
.- Parameters:
input
- anInputStream
that supportsInputStream.mark(int)
.format
- thepayload
format- Returns:
- the sniffed
PhenopacketElement
. - Throws:
IOException
- in case an error occurs while reading theinput
.SniffException
- if theinput
does not supportInputStream.mark(int)
.
-
sniff
public static PhenopacketElement sniff(byte[] payload, PhenopacketSchemaVersion schemaVersion, PhenopacketFormat format) throws ElementSniffException Deprecated.in favor ofsniff(byte[], PhenopacketFormat)
Make an educated guess ofPhenopacketElement
based on givenpayload
.- Parameters:
payload
- buffer with at least the firstBUFFER_SIZE
bytes of the input.format
- thepayload
format- Returns:
- the sniffed
PhenopacketElement
. - Throws:
ElementSniffException
- if the payload looks suspicious, e.g. contains a unique phenopacket field and a unique cohort field at the same time
-
sniff
public static PhenopacketElement sniff(byte[] payload, PhenopacketFormat format) throws ElementSniffException Make an educated guess ofPhenopacketElement
based on givenpayload
.- Parameters:
payload
- buffer with at least the firstBUFFER_SIZE
bytes of the input.format
- thepayload
format- Returns:
- the sniffed
PhenopacketElement
. - Throws:
ElementSniffException
- if the payload looks suspicious, e.g. contains a unique phenopacket field and a unique cohort field at the same time
-
sniff(byte[], PhenopacketFormat)