Package 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
`FileDescriptor​(File file)` Creates file descriptor.
`FileDescriptor​(File file, @Nullable Long idx)` Creates file descriptor.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`int` `compareTo​(FileDescriptor o)`
`boolean` `equals​(Object o)`
`File` `file()`
`static String` `fileName​(long idx)` Getting segment file name.
`String` `getAbsolutePath()` Return absolute pathname string of this file descriptor pathname.
`long` `getIdx()` Return absolute WAL segment file index.
`int` `hashCode()`
`long` `idx()`
`boolean` `isCompressed()`
`SegmentIO` `toReadOnlyIO​(FileIOFactory fileIOFactory)` Make fileIo by this description.
`String` `toString()`

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

`clone, finalize, getClass, notify, notifyAll, 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​(File file)

Creates file descriptor. Index is restored from file name.

Parameters:
  `file` - WAL segment file.

#### FileDescriptor

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

Creates file descriptor.

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 idx)

Getting segment file name.

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

#### compareTo

    public int compareTo​(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()

Return absolute WAL segment file index.

Returns:
  Absolute WAL segment file index.

#### getAbsolutePath

    public String getAbsolutePath()

Return absolute pathname string of this file descriptor pathname.

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`

#### toReadOnlyIO

    public SegmentIO toReadOnlyIO​(FileIOFactory fileIOFactory)
                           throws IOException

Make fileIo by this description.

Specified by:
  `toReadOnlyIO` 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.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`