org.cloudfoundry.client.lib.archive
Class AbstractApplicationArchiveEntry

java.lang.Object
  extended by org.cloudfoundry.client.lib.archive.AbstractApplicationArchiveEntry
All Implemented Interfaces:
ApplicationArchive.Entry

public abstract class AbstractApplicationArchiveEntry
extends Object
implements ApplicationArchive.Entry

Base implementation of ApplicationArchive.Entry that is reads the input stream to deduce the size and SHA digest.

Author:
Phillip Webb

Field Summary
protected static int UNDEFINED_SIZE
           
 
Constructor Summary
AbstractApplicationArchiveEntry()
           
 
Method Summary
 byte[] getSha1Digest()
          Returns a SHA1 digest over the contents of the entry or null if the entry is a directory.
 long getSize()
          Returns the size of entry or 0 if the entry is a directory.
protected  void setSha1Digest(byte[] sha1Digest)
          Sets the SHA1 digest that should be returned.
protected  void setSize(long size)
          Sets the size that should be returned.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.cloudfoundry.client.lib.archive.ApplicationArchive.Entry
getInputStream, getName, isDirectory
 

Field Detail

UNDEFINED_SIZE

protected static final int UNDEFINED_SIZE
See Also:
Constant Field Values
Constructor Detail

AbstractApplicationArchiveEntry

public AbstractApplicationArchiveEntry()
Method Detail

setSize

protected void setSize(long size)
Sets the size that should be returned. If this method is not called the size will be deduced by reading the stream.

Parameters:
size - the size.

getSize

public long getSize()
Description copied from interface: ApplicationArchive.Entry
Returns the size of entry or 0 if the entry is a directory.

Specified by:
getSize in interface ApplicationArchive.Entry
Returns:
the size

setSha1Digest

protected void setSha1Digest(byte[] sha1Digest)
Sets the SHA1 digest that should be returned. If this method is not called the digest will be deduced by reading the stream.

Parameters:
sha1Digest -

getSha1Digest

public byte[] getSha1Digest()
Description copied from interface: ApplicationArchive.Entry
Returns a SHA1 digest over the contents of the entry or null if the entry is a directory.

Specified by:
getSha1Digest in interface ApplicationArchive.Entry
Returns:
the SHA1 digest


Copyright © 2013. All rights reserved.