public class

DataHelper

extends Object
java.lang.Object
   ↳ org.hibernate.type.descriptor.java.DataHelper

Class Overview

A help for dealing with BLOB and CLOB data

Summary

Public Constructors
DataHelper()
Public Methods
static byte[] extractBytes(InputStream inputStream, long start, int length)
Extract a portion of the bytes from the given stream.
static byte[] extractBytes(InputStream inputStream)
Extract by bytes from the given stream.
static String extractString(Reader reader)
Extract the contents of the given reader/stream as a string.
static boolean isNClob(Class type)
static InputStream subStream(InputStream inputStream, long start, int length)
Extract a portion of the bytes from the given stream., wrapping them in a new stream.
static Object subStream(Reader characterStream, long start, int length)
Extract a portion of a reader, wrapping the portion in a new reader.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public DataHelper ()

Public Methods

public static byte[] extractBytes (InputStream inputStream, long start, int length)

Extract a portion of the bytes from the given stream.

Parameters
inputStream The stream of bytes.
start The start position/offset (0-based, per general stream/reader contracts).
length The amount to extract
Returns
  • The extracted bytes

public static byte[] extractBytes (InputStream inputStream)

Extract by bytes from the given stream.

Parameters
inputStream The stream of bytes.
Returns
  • The contents as a byte[]

public static String extractString (Reader reader)

Extract the contents of the given reader/stream as a string.

Parameters
reader The reader for the content
Returns
  • The content as string

public static boolean isNClob (Class type)

public static InputStream subStream (InputStream inputStream, long start, int length)

Extract a portion of the bytes from the given stream., wrapping them in a new stream.

Parameters
inputStream The stream of bytes.
start The start position/offset (0-based, per general stream/reader contracts).
length The amount to extract
Returns
  • The extracted bytes as a stream

public static Object subStream (Reader characterStream, long start, int length)

Extract a portion of a reader, wrapping the portion in a new reader.

Parameters
characterStream The reader for the content
start The start position/offset (0-based, per general stream/reader contracts).
length The amount to extract
Returns
  • The content portion as a reader