org.apache.jackrabbit.value
Class BinaryImpl

java.lang.Object
  extended by org.apache.jackrabbit.value.BinaryImpl
All Implemented Interfaces:
Binary

public class BinaryImpl
extends Object
implements Binary

BinaryImpl implements the Binary interface.


Constructor Summary
BinaryImpl(byte[] buffer)
          Creates a new BinaryImpl instance from a byte[] array.
BinaryImpl(InputStream in)
          Creates a new BinaryImpl instance from an InputStream.
 
Method Summary
 void dispose()
          
 long getSize()
          
 InputStream getStream()
          
 int read(byte[] b, long position)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BinaryImpl

public BinaryImpl(InputStream in)
           throws IOException
Creates a new BinaryImpl instance from an InputStream. The contents of the stream is spooled to a temporary file or to a byte buffer if its size is smaller than MAX_BUFFER_SIZE.

Parameters:
in - stream to be represented as a BLOBFileValue instance
Throws:
IOException - if an error occurs while reading from the stream or writing to the temporary file

BinaryImpl

public BinaryImpl(byte[] buffer)
Creates a new BinaryImpl instance from a byte[] array.

Parameters:
buffer - byte array to be represented as a BinaryImpl instance
Method Detail

getStream

public InputStream getStream()
                      throws RepositoryException

Specified by:
getStream in interface Binary
Throws:
RepositoryException

read

public int read(byte[] b,
                long position)
         throws IOException,
                RepositoryException

Specified by:
read in interface Binary
Throws:
IOException
RepositoryException

getSize

public long getSize()
             throws RepositoryException

Specified by:
getSize in interface Binary
Throws:
RepositoryException

dispose

public void dispose()

Specified by:
dispose in interface Binary


Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.