org.apache.ignite.internal.processors.cache.persistence.wal

## Class FileDescriptor

- java.lang.Object
- - org.apache.ignite.internal.processors.cache.persistence.wal.FileDescriptor

All Implemented Interfaces:
  Comparable<FileDescriptor>, AbstractWalRecordsIterator.AbstractFileDescriptor

    public class FileDescriptor
    extends Object
    implements Comparable<FileDescriptor>, AbstractWalRecordsIterator.AbstractFileDescriptor

WAL file descriptor.

### Field Summary

Fields
`protected File` `file` File represented by this class.
`protected long` `idx` Absolute WAL segment file index.

### Constructor Summary

Constructors
Constructor and Description
`FileDescriptor(@NotNull File file)` Creates file descriptor.
`FileDescriptor(@NotNull File file, @Nullable Long idx)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`int` `compareTo(@NotNull FileDescriptor o)`
`boolean` `equals(Object o)`
`File` `file()`
`static String` `fileName(long segment)`
`String` `getAbsolutePath()`
`long` `getIdx()`
`int` `hashCode()`
`long` `idx()`
`boolean` `isCompressed()`
`SegmentIO` `toIO(FileIOFactory fileIOFactory)` Make fileIo by this description.

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### file

    protected final File file

File represented by this class.

#### idx

    protected final long idx

Absolute WAL segment file index.

### Constructor Detail

#### FileDescriptor

    public FileDescriptor(@NotNull
                          @NotNull File file)

Creates file descriptor. Index is restored from file name.

Parameters:
  `file` - WAL segment file.

#### FileDescriptor

    public FileDescriptor(@NotNull
                          @NotNull File file,
                          @Nullable
                          @Nullable Long idx)

Parameters:
  `file` - WAL segment file.
  `idx` - Absolute WAL segment file index. For null value index is restored from file name.

### Method Detail

#### fileName

    public static String fileName(long segment)

Parameters:
  `segment` - Segment index.
Returns:
  Segment file name.

#### compareTo

    public int compareTo(@NotNull
                         @NotNull FileDescriptor o)

Specified by:
  `compareTo` in interface `Comparable<FileDescriptor>`

#### equals

    public boolean equals(Object o)

Overrides:
  `equals` in class `Object`

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `Object`

#### getIdx

    public long getIdx()

Returns:
  Absolute WAL segment file index

#### getAbsolutePath

    public String getAbsolutePath()

Returns:
  absolute pathname string of this file descriptor pathname.

#### isCompressed

    public boolean isCompressed()

Specified by:
  `isCompressed` in interface `AbstractWalRecordsIterator.AbstractFileDescriptor`

#### file

    public File file()

Specified by:
  `file` in interface `AbstractWalRecordsIterator.AbstractFileDescriptor`

#### idx

    public long idx()

Specified by:
  `idx` in interface `AbstractWalRecordsIterator.AbstractFileDescriptor`

#### toIO

    public SegmentIO toIO(FileIOFactory fileIOFactory)
                   throws IOException

Make fileIo by this description.

Specified by:
  `toIO` in interface `AbstractWalRecordsIterator.AbstractFileDescriptor`
Parameters:
  `fileIOFactory` - Factory for fileIo creation.
Returns:
  One of implementation of `FileIO`.
Throws:
  `IOException` - if creation of fileIo was not success.

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.9.1
Release Date | : December 9 2020