src/main/java/com/cloudbees/jenkins/support/util/StreamUtils.java
public static boolean isNonWhitespaceControlCharacter(@NonNull byte[] b) {
        ByteBuffer head = ByteBuffer.allocate(DEFAULT_PROBE_SIZE);
        int toCopy = Math.min(head.remaining(), b.length);
        if (toCopy == 0) {
            throw new IllegalStateException("No more room to buffer header, should have chosen stream by now");
        }

        head.put(b, 0, toCopy);
        head.flip().mark();
        return isNonWhitespaceControlCharacter(head);
    }
/**
     * Check if the content of a byte array is binary
     * @param b byte array to check
     * @return true if the content is binary (Non-white Control Characters)
     */
Check if the content of a byte array is binary
@param b byte array to check
@return true if the content is binary (Non-white Control Characters)
Check if the content of a byte array is binary @param b byte array to check @return true if the content is binary ( Non - white Control Characters )
public static boolean isNonWhitespaceControlCharacter(@NonNull byte[] b) {
        ByteBuffer head = ByteBuffer.allocate(DEFAULT_PROBE_SIZE);
        int toCopy = Math.min(head.remaining(), b.length);
        if (toCopy == 0) {
            throw new IllegalStateException("No more room to buffer header, should have chosen stream by now");
        }
        head.put(b, 0, toCopy);
        head.flip().mark();
        return isNonWhitespaceControlCharacter(head);
    }
public static boolean isNonWhitespaceControlCharacter ( @ NonNull byte [ ] b ) { ByteBuffer head = ByteBuffer . allocate ( DEFAULT_PROBE_SIZE ) ; int toCopy = Math . min ( head . remaining ( ) , b . length ) ; if ( toCopy == 0 ) { throw new IllegalStateException ( "No more room to buffer header, should have chosen stream by now" ) ; } head . put ( b , 0 , toCopy ) ; head . flip ( ) . mark ( ) ; return isNonWhitespaceControlCharacter ( head ) ; }
Check if the content of a byte array is binary
 @param b byte array to check
 @return true if the content is binary (Non-white Control Characters)
Check if the content of a byte array is binary @param b byte array to check @return true if the content is binary ( Non - white Control Characters )