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 FileSystemBinary

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

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

    @Immutable
    public class FileSystemBinary

extends AbstractBinary

An implementation of `Binary` that is used to access the content of a file on the file system without holding any content 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
`FileSystemBinary(File file)`

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` | `purge()` A method that signals that any data kept in memory should be purged as it is no longer needed.
`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

### FileSystemBinary

    public FileSystemBinary(File file)

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.getBytes()`

### getStream

    public InputStream getStream()

  Get the contents of this data as a stream.

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

### 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()`

### purge

    public void purge()

  Description copied from interface: `Binary`
  A method that signals that any data kept in memory should be purged as it is no longer needed.

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.