public static byte[] readByteArray(DataInputStream in) throws IOException {
        int length = in.readInt();
        byte[] array = new byte[length];
        for (int i = 0; i < length; i++) {
            array[i] = in.readByte();
        }
        return array;
    }
Misc utility functions to help serialization of {@link PredicateIndex}.

@author bjorncs
predicate-search/src/main/java/com/yahoo/search/predicate/serialization/SerializationHelper.java