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 PhenopacketElementsniff(byte[] payload, PhenopacketFormat format) Make an educated guess ofPhenopacketElementbased on givenpayload.static PhenopacketElementsniff(byte[] payload, PhenopacketSchemaVersion schemaVersion, PhenopacketFormat format) Deprecated.static PhenopacketElementsniff(InputStream input, PhenopacketFormat format) Make an educated guess ofPhenopacketElementpresent in giveninput.static PhenopacketElementsniff(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 ofPhenopacketElementpresent in giveninput.- Parameters:
input- anInputStreamthat supportsInputStream.mark(int).format- thepayloadformat- Returns:
- the sniffed
PhenopacketElement. - Throws:
IOException- in case an error occurs while reading theinput.SniffException- if there are not enough bytes available in theinputof if theinputdoes not supportInputStream.mark(int).
-
sniff
public static PhenopacketElement sniff(InputStream input, PhenopacketFormat format) throws IOException, SniffException Make an educated guess ofPhenopacketElementpresent in giveninput.- Parameters:
input- anInputStreamthat supportsInputStream.mark(int).format- thepayloadformat- Returns:
- the sniffed
PhenopacketElement. - Throws:
IOException- in case an error occurs while reading theinput.SniffException- if theinputdoes 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 ofPhenopacketElementbased on givenpayload.- Parameters:
payload- buffer with at least the firstBUFFER_SIZEbytes of the input.format- thepayloadformat- 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 ofPhenopacketElementbased on givenpayload.- Parameters:
payload- buffer with at least the firstBUFFER_SIZEbytes of the input.format- thepayloadformat- 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)