Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.hibernate.type.descriptor.java
Class DataHelper

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

    public class DataHelper

extends Object

A help for dealing with BLOB and CLOB data

Constructor Summary
`DataHelper()`

Method Summary
`static byte[]` | `extractBytes(InputStream inputStream)` Extract by bytes from the given stream.
`static byte[]` | `extractBytes(InputStream inputStream, long start, int length)` Extract a portion of the bytes from the given stream.
`static String` | `extractString(Clob value)` Extract the contents of the given Clob as a string.
`static String` | `extractString(Reader reader)` Extract the contents of the given reader/stream as a string.
`static String` | `extractString(Reader reader, int lengthHint)` 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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DataHelper

    public DataHelper()

Method Detail

### isNClob

    public static boolean isNClob(Class type)

### extractString

    public static String extractString(Reader reader)

  Extract the contents of the given reader/stream as a string. The reader will be closed.

  Parameters:
    `reader` - The reader for the content
  Returns:
    The content as string

### extractString

    public static String extractString(Reader reader,
                                       int lengthHint)

  Extract the contents of the given reader/stream as a string. The reader will be closed.

  Parameters:
    `reader` - The reader for the content
    `lengthHint` - if the length is known in advance the implementation can be slightly more efficient
  Returns:
    The content as string

### subStream

    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

### extractBytes

    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[]`

### extractBytes

    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

### subStream

    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

### extractString

    public static String extractString(Clob value)

  Extract the contents of the given Clob as a string.

  Parameters:
    `reader` - The reader for the content
  Returns:
    The content as string

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2012 Red Hat, Inc. All Rights Reserved.