eu.scape_project.core.model
Class ByteStreamInfo

java.lang.Object
  extended by eu.scape_project.core.model.ByteStreamInfo

public final class ByteStreamInfo
extends Object

Version:
0.1 Created Dec 5, 2011:2:34:00 PM
Author:
Carl Wilson carlwilson-bl AT SourceForge carlwilson-bl AT github

Method Summary
 void addDigest(JavaDigestValue digest)
           
 boolean equals(Object obj)
           
 Set<JavaDigestValue> getDigests()
           
static ByteStreamInfo getInstance(DigestValue.DigestAlgorithm[] algorithms, InputStream is)
           
static ByteStreamInfo getInstance(long length, JavaDigestValue checksum)
           
static ByteStreamInfo getInstance(long length, JavaDigestValue checksum, String mime)
           
static ByteStreamInfo getInstance(String xml)
           
 long getLength()
           
 String getMimeType()
           
 int hashCode()
           
 String toString()
           
 String toXml()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

addDigest

public void addDigest(JavaDigestValue digest)
Parameters:
digest - a digest value

getLength

public long getLength()
Returns:
the size of the byte stream in bytes

getDigests

public Set<JavaDigestValue> getDigests()
Returns:
the set of digests known for this byte sequence

getMimeType

public String getMimeType()
Returns:
the recorded MIME type of the file

toXml

public String toXml()
             throws JAXBException
Returns:
a String xml representation of the object
Throws:
JAXBException

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

getInstance

public static ByteStreamInfo getInstance(String xml)
                                  throws JAXBException
Parameters:
xml -
Returns:
a new JavaDigestValue object serialized from XML
Throws:
JAXBException

getInstance

public static ByteStreamInfo getInstance(long length,
                                         JavaDigestValue checksum)
Parameters:
length - the length of the byte sequence in bytes
checksum - details of a checksum
Returns:
a new ByteStreamInfo instance created from the params

getInstance

public static ByteStreamInfo getInstance(long length,
                                         JavaDigestValue checksum,
                                         String mime)
Parameters:
length - the length of the byte sequence in bytes
checksum - details of a checksum
mime - the mime type of the item
Returns:
a new ByteStreamInfo instance created from the params

getInstance

public static ByteStreamInfo getInstance(DigestValue.DigestAlgorithm[] algorithms,
                                         InputStream is)
                                  throws IOException,
                                         NoSuchAlgorithmException
Parameters:
algorithms -
is -
Returns:
a new ByteStream information instance containing the requested digests, calculated from the stream.
Throws:
IOException
NoSuchAlgorithmException


Copyright © 2013. All Rights Reserved.