private byte[] getBase64Decoded() throws SQLException { final String string = super.getString(); if (null == string) { return null; } // Need to base64 decode the string. return ByteString.parseBase64(string); }
/** * Creates a byte string from a Base64 string. * * @param string Base64 string * @return Byte string */ public static ByteString ofBase64(String string) { final byte[] bytes = parseBase64(string); return new ByteString(bytes, false); }
private byte[] getBase64Decoded() throws SQLException { final String string = super.getString(); if (null == string) { return null; } // Need to base64 decode the string. return ByteString.parseBase64(string); }
private byte[] getBase64Decoded() { final String string = super.getString(); if (null == string) { return null; } // Need to base64 decode the string. return ByteString.parseBase64(string); }
/** * Creates a byte string from a Base64 string. * * @param string Base64 string * @return Byte string */ public static ByteString ofBase64(String string) { final byte[] bytes = parseBase64(string); return new ByteString(bytes, false); }
/** * Creates a byte string from a Base64 string. * * @param string Base64 string * @return Byte string */ public static ByteString ofBase64(String string) { final byte[] bytes = parseBase64(string); return new ByteString(bytes, false); }
@Override public byte[] getBytes() throws SQLException { Object obj = getObject(); if (null == obj) { return null; } if (obj instanceof ByteString) { return ((ByteString) obj).getBytes(); } else if (obj instanceof String) { // Need to unwind the base64 for JSON return ByteString.parseBase64((String) obj); } else if (obj instanceof byte[]) { // Protobuf would have a byte array return (byte[]) obj; } else { throw new RuntimeException("Cannot handle " + obj.getClass() + " as bytes"); } }
@Override public byte[] getBytes() throws SQLException { Object obj = getObject(); if (null == obj) { return null; } if (obj instanceof ByteString) { return ((ByteString) obj).getBytes(); } else if (obj instanceof String) { // Need to unwind the base64 for JSON return ByteString.parseBase64((String) obj); } else if (obj instanceof byte[]) { // Protobuf would have a byte array return (byte[]) obj; } else { throw new RuntimeException("Cannot handle " + obj.getClass() + " as bytes"); } }
bytes = ByteString.parseBase64((String) o); } else {
bytes = ByteString.parseBase64((String) o); } else {