Class ShardedFile

java.lang.Object
org.ojalgo.netio.ShardedFile
All Implemented Interfaces:
Serializable

public final class ShardedFile extends Object implements Serializable
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • numberOfShards

      public final int numberOfShards
    • single

      public final File single
      A valid single file used as a template when creating the shards. Can also be used for meta data or merged/aggregated data from the shards.
    • myShards

      private transient File[] myShards
  • Constructor Details

    • ShardedFile

      ShardedFile(File template, int nbShards)
  • Method Details

    • of

      public static ShardedFile of(File template, int nbShards)
    • of

      public static ShardedFile of(File templateFolder, String templateFile, int nbShards)
    • splitToShards

      private static File[] splitToShards(File file, int numberOfShards)
    • delete

      public void delete()
      Explicitly delete all files/shards as well as the parent directory (make sure there is nothing else in that directory)
    • directory

      public File directory()
      Returns:
      A parent directory to all the shards
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • files

      public List<File> files()
      Returns:
      Same as shards() but as a List.
    • filesWithShardIndex

      public List<EntryPair.KeyedPrimitive<File>> filesWithShardIndex()
      Returns:
      Same as files() but paired with the shard index.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • newSequencedFactory

      public <T> Supplier<FromFileReader<T>> newSequencedFactory(Function<File,FromFileReader<T>> factory)
      Each reader instantiated by this factory will read from the shards in sequence, until all of them are done. The idea is that you can create multiple readers and have them work in parallel (each shard will only be read once by one of the readers).
    • shard

      public File shard(int index)
    • shards

      public File[] shards()
    • toString

      public String toString()
      Overrides:
      toString in class Object