Java Code Examples for org.hibernate.type.descriptor.java.DataHelper

The following examples show how to use org.hibernate.type.descriptor.java.DataHelper. These examples are extracted from open source projects. 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 Project: lams   Source File: BlobProxy.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Override
public byte[] getBytes() {
	if ( bytes == null ) {
		bytes = DataHelper.extractBytes( stream );
	}
	return bytes;
}
 
Example 2
Source Project: lams   Source File: CharacterStreamImpl.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Override
public String asString() {
	if ( string == null ) {
		string = DataHelper.extractString( reader );
	}
	return string;
}
 
Example 3
Source Project: spring-data-jpa-extra   Source File: JSONType.java    License: Apache License 2.0 5 votes vote down vote up
private static String extractString(Object value) {
    if (value == null) {
        return null;
    }
    if (value instanceof String) {
        return (String) value;
    }
    if (value instanceof Reader) {
        return DataHelper.extractString((Reader) value);
    }
    if (value instanceof Clob) {
        return DataHelper.extractString((Clob) value);
    }
    return null;
}
 
Example 4
Source Project: cosmo   Source File: BufferedContentTypeDescriptor.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public <X> X unwrap(BufferedContent value, Class<X> type, WrapperOptions options) {
    if (value == null) {
        return null;
    }
    if (BufferedContent.class.isAssignableFrom(type)) {
        return (X) value;
    }
    if (BinaryStream.class.isAssignableFrom(type)) {
        return (X) new BinaryStreamImpl(DataHelper.extractBytes(value.getInputStream()));
    }
    throw unknownUnwrap(type);
}
 
Example 5
Source Project: lams   Source File: AbstractHANADialect.java    License: GNU General Public License v2.0 4 votes vote down vote up
@Override
public long position(Clob searchstr, long start) throws SQLException {
	return this.data.indexOf( DataHelper.extractString( searchstr ), (int) ( start - 1 ) );
}
 
Example 6
@Override
public String convert(Clob source) {
    return DataHelper.extractString(source);
}
 
Example 7
Source Project: cosmo   Source File: BufferedContentTypeDescriptor.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public String toString(BufferedContent value) {
    final byte[] bytes;
    bytes = DataHelper.extractBytes(value.getInputStream());
    return PrimitiveByteArrayTypeDescriptor.INSTANCE.toString(bytes);
}