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.modeshape.graph.property
Interface Binary

All Superinterfaces:
  Comparable<Binary>, Serializable

    @Immutable
    public interface Binary

extends Comparable<Binary>, Serializable

Value holder for binary data. Binary instances are not mutable.

Method Summary
`void` | `acquire()` Acquire any resources for this data.
`byte[]` | `getBytes()` Get the contents of this data as a byte array.
`byte[]` | `getHash()` Get the SHA-1 hash of the contents.
`long` | `getSize()` Get the length of this binary data.
`InputStream` | `getStream()` Get the contents of this data as a stream.
`void` | `release()` Release any acquired resources.

Methods inherited from interface java.lang.Comparable
`compareTo`

Method Detail

### getSize

    long getSize()

  Get the length of this binary data.

  Returns:
    the number of bytes in this binary data
  See Also:
    `acquire()`

### getHash

    byte[] getHash()

  Get the SHA-1 hash of the contents. This hash can be used to determine whether two Binary instances contain the same content.

  Repeatedly calling this method should generally be efficient, as it most implementations will compute the hash only once.

  Returns:
    the hash of the contents as a byte array, or an empty array if the hash could not be computed.
  See Also:
    `acquire()`, `MessageDigest.digest(byte[])`, `MessageDigest.getInstance(String)`

### getStream

    InputStream getStream()

  Get the contents of this data as a stream.

  Returns:
    the stream to this data's contents
  Throws:
    `IoException` - if there is a problem returning the stream
  See Also:
    `acquire()`

### getBytes

    byte[] getBytes()

  Get the contents of this data as a byte array.

  Returns:
    the data as an array
  Throws:
    `IoException` - if there is a problem returning the bytes
  See Also:
    `acquire()`

### acquire

    void acquire()

  Acquire any resources for this data. This method must be called before any other method on this object.

  See Also:
    `release()`

### release

    void release()

  Release any acquired resources. This method must be called after a client is finished with this value.

  See Also:
    `acquire()`

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 © 2008-2011 JBoss, a division of Red Hat. All Rights Reserved.