|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.InputStream
java.io.FilterInputStream
org.mycore.datamodel.ifs.MCRContentInputStream
public class MCRContentInputStream
This input stream is used by the MyCoRe filesystem classes to read the content of a file and import it into the System. MCRContentInputStream provides the header of the file that is read (the first 64k) for content type detection purposes, counts the number of bytes read and builds an MD5 checksum String while content goes through this input stream.
| Field Summary | |
|---|---|
protected MessageDigest |
digest
The MD5 checksum of all bytes read through this stream |
protected byte[] |
header
The header of the file read |
protected static int |
headerSize
The number of bytes that will be read for content type detection |
protected long |
length
The total number of bytes read so far |
| Fields inherited from class java.io.FilterInputStream |
|---|
in |
| Constructor Summary | |
|---|---|
MCRContentInputStream(InputStream in)
Constructs a new MCRContentInputStream |
|
| Method Summary | |
|---|---|
static MessageDigest |
buildMD5Digest()
Builds a MessageDigest instance for MD5 checksum computation. |
byte[] |
getHeader()
Returns the first 64 k of the underlying input stream. |
long |
getLength()
Returns the number of bytes read so far |
byte[] |
getMD5()
Returns the MD5 message digest that has been built during reading of the underlying input stream. |
String |
getMD5String()
Returns the MD5 checksum as a String |
static String |
getMD5String(MessageDigest digest)
Given an MD5 message digest, returns the MD5 checksum as a String |
int |
read()
|
int |
read(byte[] buf,
int off,
int len)
|
| Methods inherited from class java.io.FilterInputStream |
|---|
available, close, mark, markSupported, read, reset, skip |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final int headerSize
protected MessageDigest digest
protected long length
protected byte[] header
| Constructor Detail |
|---|
public MCRContentInputStream(InputStream in)
throws MCRException
in - the InputStream to read from
MCRConfigurationException - if java classes supporting MD5 checksums are not found
MCRException| Method Detail |
|---|
public int read()
throws IOException
read in class FilterInputStreamIOException
public int read(byte[] buf,
int off,
int len)
throws IOException
read in class FilterInputStreamIOExceptionpublic byte[] getHeader()
public long getLength()
public byte[] getMD5()
public String getMD5String()
public static String getMD5String(MessageDigest digest)
public static MessageDigest buildMD5Digest()
MCRConfigurationException - if no java classes that support MD5 algorithm could be found
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||