Java Code Examples for com.datastax.driver.core.utils.Bytes#toHexString()
The following examples show how to use
com.datastax.driver.core.utils.Bytes#toHexString() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CassandraType.java From presto with Apache License 2.0 | 4 votes |
public String getColumnValueForCql(Row row, int position) { if (row.isNull(position)) { return null; } switch (this) { case ASCII: case TEXT: case VARCHAR: return quoteStringLiteral(row.getString(position)); case INT: return Integer.toString(row.getInt(position)); case SMALLINT: return Short.toString(row.getShort(position)); case TINYINT: return Byte.toString(row.getByte(position)); case BIGINT: case COUNTER: return Long.toString(row.getLong(position)); case BOOLEAN: return Boolean.toString(row.getBool(position)); case DOUBLE: return Double.toString(row.getDouble(position)); case FLOAT: return Float.toString(row.getFloat(position)); case DECIMAL: return row.getDecimal(position).toString(); case UUID: case TIMEUUID: return row.getUUID(position).toString(); case TIMESTAMP: return Long.toString(row.getTimestamp(position).getTime()); case DATE: return row.getDate(position).toString(); case INET: return quoteStringLiteral(toAddrString(row.getInet(position))); case VARINT: return row.getVarint(position).toString(); case BLOB: case CUSTOM: return Bytes.toHexString(row.getBytesUnsafe(position)); default: throw new IllegalStateException("Handling of type " + this + " is not implemented"); } }
Example 2
Source File: BytesBlobCodec.java From cassandra-jdbc-driver with Apache License 2.0 | 4 votes |
@Override public String format(byte[] value) { if (value == null) return "NULL"; return Bytes.toHexString(value); }