gov.loc.repository.bagit
Interface BagFile

All Known Subinterfaces:
BagInfoTxt, BagItTxt, FetchTxt, Manifest

public interface BagFile

Represents a file in a bag. The file may be either a tag file, such as a Manifest or a BagInfoTxt, or it may be an ordinary payload file.


Method Summary
 boolean exists()
          Determines whether the file exists on disk or not.
 java.lang.String getFilepath()
          Gets the path of the file, relative to the bag directory.
 long getSize()
          Gets the size of the file on disk.
 java.io.InputStream newInputStream()
          Opens the file for reading.
 

Method Detail

newInputStream

java.io.InputStream newInputStream()
Opens the file for reading.

Returns:
A new stream for reading the contents of the file.
Throws:
java.lang.RuntimeException - Thrown if the file cannot be opened.

getFilepath

java.lang.String getFilepath()
Gets the path of the file, relative to the bag directory.

Returns:
The path of the file. Will never be null.

exists

boolean exists()
Determines whether the file exists on disk or not.

Returns:
Return true if the file file exists; false otherwise.

getSize

long getSize()
Gets the size of the file on disk.

Returns:
The size of the file, or 0 if the file does not exist.