Java Code Examples for org.hibernate.type.descriptor.java.DataHelper#extractBytes()

The following examples show how to use org.hibernate.type.descriptor.java.DataHelper#extractBytes() . 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: BlobProxy.java    From lams with 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 File: BufferedContentTypeDescriptor.java    From cosmo with 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 3
Source File: BufferedContentTypeDescriptor.java    From cosmo with 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);
}