eu.scape_project.core.model
Class ByteStreamInfo
java.lang.Object
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
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 byteschecksum
- 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 byteschecksum
- details of a checksummime
- 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.