fileref

package
v1.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package fileref provides a unified representation of 64-bit and 128-bit file identifiers used in NTFS and ReFS file systems.

New identifiers are created by calling New64, New128, BigEndian or LittleEndian.

Index

Constants

View Source
const (
	FileType = iota
	ObjectIDType
	ExtendedFileIDType
)

File ID discriminator

Variables

This section is empty.

Functions

This section is empty.

Types

type Descriptor

type Descriptor struct {
	Size uint32
	Type uint32
	Data [16]byte
}

Descriptor is a file reference descriptor that can be used in file system API calls.

type ID

type ID [16]byte

ID is a file identifer capable of holding 64-bit and 128-bit values.

ID is stored as a big-endian byte sequence. NTFS and ReFS use a little-endian byte sequence, so the LittleEndian function should be used to create identifiers for byte sequences taken from those file systems.

func BigEndian

func BigEndian(value [16]byte) ID

BigEndian creates a file identifier from a sequence of bytes in big-endian byte order.

func LittleEndian

func LittleEndian(value [16]byte) ID

LittleEndian creates a file identifier from a sequence of bytes in little-endian byte order.

func New128

func New128(lower int64, upper int64) (id ID)

New128 returns a 128-bit file identifier for a set of lower and upper 64 bit values.

func New64

func New64(value int64) (id ID)

New64 returns a 64-bit file identifier.

func (ID) BigEndian

func (id ID) BigEndian() (value [16]byte)

BigEndian returns the ID as a sequence of bytes in big-endian byte order.

func (ID) Descriptor

func (id ID) Descriptor() Descriptor

Descriptor returns a descriptor for the file id.

func (ID) Int64

func (id ID) Int64() int64

Int64 returns the file identifier as a 64-bit signed integer if it can be represented as one. If it cannot, -1 is returned.

func (ID) IsInt64

func (id ID) IsInt64() bool

IsInt64 returns true if the file identifier can be represented as a 64-bit signed integer.

func (ID) IsZero

func (id ID) IsZero() bool

IsZero returns true if the file identifier is zero.

func (ID) LittleEndian

func (id ID) LittleEndian() (value [16]byte)

LittleEndian returns the ID as a sequence of bytes in little-endian byte order.

func (ID) Split

func (id ID) Split() (upper, lower int64)

Split breaks the ID into upper and lower 64-bit values.

func (ID) String

func (id ID) String() string

String returns a string representation of the file identifier.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL