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.basic
Class InMemoryBinary

    java.lang.Object
      org.modeshape.graph.property.basic.AbstractBinary
          org.modeshape.graph.property.basic.InMemoryBinary

All Implemented Interfaces:
  Serializable, Comparable<Binary>, Binary

    @Immutable
    public class InMemoryBinary

extends AbstractBinary

An implementation of `Binary` that keeps the binary data in-memory.

See Also:
  Serialized Form

Field Summary

Fields inherited from class org.modeshape.graph.property.basic.AbstractBinary
`ALGORITHMS_NOT_FOUND_AND_LOGGED, EMPTY_CONTENT`

Constructor Summary
`InMemoryBinary(byte[] bytes)`

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.
`int` | `hashCode()`
`void` | `release()` Release any acquired resources.

Methods inherited from class org.modeshape.graph.property.basic.AbstractBinary
`compareTo, computeHash, computeHash, computeHash, equals, getReadableSize, toString`

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

Constructor Detail

### InMemoryBinary

    public InMemoryBinary(byte[] bytes)

Method Detail

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`
  See Also:
    `Object.hashCode()`

### getSize

    public long getSize()

  Get the length of this binary data.

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

### getHash

    public 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:
    `Binary.getHash()`

### getBytes

    public byte[] getBytes()

  Get the contents of this data as a byte array.

  Returns:
    the data as an array
  See Also:
    `Binary.acquire()`

### getStream

    public InputStream getStream()

  Get the contents of this data as a stream.

  Returns:
    the stream to this data's contents
  See Also:
    `Binary.acquire()`

### acquire

    public void acquire()

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

  See Also:
    `Binary.release()`

### release

    public void release()

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

  See Also:
    `Binary.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.