Search code examples
javafastinfoset

How to check whether a byte array corrupted FastInfoSet Document


How to check whether a byte array is a corrupted FastInfoSet Document or just binary garbage?

I mean maybe exists some binary "header" that we can check this.


Solution

  • There is exists static method isFastInfosetDocument in com.sun.xml.internal.fastinfoset.Decoder class that check the first 4 bytes in java.io.InputStream.

    Of course it will work only if not corrupted the first 4 bytes.