Class StoreFileMetadata

java.lang.Object
org.elasticsearch.index.store.StoreFileMetadata
All Implemented Interfaces:
Writeable

public class StoreFileMetadata extends Object implements Writeable
  • Constructor Details

    • StoreFileMetadata

      public StoreFileMetadata(String name, long length, String checksum, String writtenBy)
    • StoreFileMetadata

      public StoreFileMetadata(String name, long length, String checksum, String writtenBy, org.apache.lucene.util.BytesRef hash)
    • StoreFileMetadata

      public StoreFileMetadata(StreamInput in) throws IOException
      Read from a stream.
      Throws:
      IOException
  • Method Details

    • writeTo

      public void writeTo(StreamOutput out) throws IOException
      Description copied from interface: Writeable
      Write this into the StreamOutput.
      Specified by:
      writeTo in interface Writeable
      Throws:
      IOException
    • name

      public String name()
      Returns the name of this file
    • length

      public long length()
      the actual file size on "disk", if compressed, the compressed size
    • checksum

      public String checksum()
      Returns a string representation of the files checksum. Since Lucene 4.8 this is a CRC32 checksum written by lucene.
    • hashEqualsContents

      public boolean hashEqualsContents()
      Checks if the bytes returned by hash() are the contents of the file that this instances refers to.
      Returns:
      true iff hash() will return the actual file contents
    • isSame

      public boolean isSame(StoreFileMetadata other)
      Returns true iff the length and the checksums are the same. otherwise false
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • writtenBy

      public String writtenBy()
      Returns a String representation of the Lucene version this file has been written by or null if unknown
    • hash

      public org.apache.lucene.util.BytesRef hash()
      Returns a variable length hash of the file represented by this metadata object. This can be the file itself if the file is small enough. If the length of the hash is 0 no hash value is available