public static byte[] toBytes(byte[] s) throws SQLException {
    if (s == null) {
      return null;
    }

    // Starting with PG 9.0, a new hex format is supported
    // that starts with "\x". Figure out which format we're
    // dealing with here.
    //
    if (s.length < 2 || s[0] != '\\' || s[1] != 'x') {
      return toBytesOctalEscaped(s);
    }
    return toBytesHexEscaped(s);
  }
public static byte [ ] toBytes ( byte [ ] s ) throws SQLException { if ( s == null ) { return null ; } if ( s . length < 2 || s [ 0 ] != '\\' || s [ 1 ] != 'x' ) { return toBytesOctalEscaped ( s ) ; } return toBytesHexEscaped ( s ) ; }
/*
Converts a PG bytea raw value (i.e. the raw binary representation of the bytea data type) into
a java byte[]