org.jSyncManager.API.Protocol.Util.VFS

Class FileReference


public class FileReference
extends java.lang.Object

A representation of a file reference for use with VFS on a device. This class is used by nearly all VFS functions that do any sort of file I/O. It provides a mechanism for identifying the file being worked on.

Field Summary

static char
OPEN_EXCLUSIVE_MODE_FLAG
A flag to denote that the file should be opened in Exclusive mode.
static char
OPEN_READ_MODE_FLAG
A flag to denote that the file should be opened for Read access.
static char
OPEN_READ_WRITE_MODE_FLAG
A flag to denote that the file should be opened for Read/Write access.
static char
OPEN_WRITE_MODE_FLAG
A flag to denote that the file should be opened for Write access.
static char
SEEK_ORIGIN_BEGINNING
A flag to denote we wish to seek from the beginning of the file.
static char
SEEK_ORIGIN_CURRENT_POSITION
A flag to denote we wish to seek from the current position in the file.
static char
SEEK_ORIGIN_END
A flag to denote we wish to seek from the end of the file.
static int
VFS_FILE_ARCHIVE
A flag to denote that the file has the archive attribute set.
static int
VFS_FILE_HIDDEN
A flag to denote that the file is hidden.
static int
VFS_FILE_IS_DIRECTORY
A flag to denote that the file is a directory.
static int
VFS_FILE_IS_LINK
A flag to denote that the file is a link.
static int
VFS_FILE_READ_ONLY
A flag to denote that the file is read only (or a directory).
static int
VFS_FILE_SYSTEM
A flag to denote that the file has the system attribute.
static int
VFS_FILE_VOLUME_LABEL
A flag to denote that the file is a volume label.

Constructor Summary

FileReference(int i)
Constructs a new file reference object.

Method Summary

int
getFileReferenceAsInt()
Retreives the integer representing this file reference.
void
putToByteArray(byte[] buffer)
Puts the file reference into an array of bytes.
void
putToByteArray(byte[] buffer, int position)
Puts the file reference into an array of bytes.

Field Details

OPEN_EXCLUSIVE_MODE_FLAG

public static final char OPEN_EXCLUSIVE_MODE_FLAG
A flag to denote that the file should be opened in Exclusive mode.
Field Value:
'\u0001'

OPEN_READ_MODE_FLAG

public static final char OPEN_READ_MODE_FLAG
A flag to denote that the file should be opened for Read access.
Field Value:
'\u0002'

OPEN_READ_WRITE_MODE_FLAG

public static final char OPEN_READ_WRITE_MODE_FLAG
A flag to denote that the file should be opened for Read/Write access.
Field Value:
'\u0007'

OPEN_WRITE_MODE_FLAG

public static final char OPEN_WRITE_MODE_FLAG
A flag to denote that the file should be opened for Write access.
Field Value:
'\u0005'

SEEK_ORIGIN_BEGINNING

public static final char SEEK_ORIGIN_BEGINNING
A flag to denote we wish to seek from the beginning of the file.
Field Value:
'\u0000'

SEEK_ORIGIN_CURRENT_POSITION

public static final char SEEK_ORIGIN_CURRENT_POSITION
A flag to denote we wish to seek from the current position in the file.
Field Value:
'\u0001'

SEEK_ORIGIN_END

public static final char SEEK_ORIGIN_END
A flag to denote we wish to seek from the end of the file.
Field Value:
'\u0002'

VFS_FILE_ARCHIVE

public static final int VFS_FILE_ARCHIVE
A flag to denote that the file has the archive attribute set.
Field Value:
32

VFS_FILE_HIDDEN

public static final int VFS_FILE_HIDDEN
A flag to denote that the file is hidden.
Field Value:
2

VFS_FILE_IS_DIRECTORY

public static final int VFS_FILE_IS_DIRECTORY
A flag to denote that the file is a directory.
Field Value:
16

VFS_FILE_IS_LINK

public static final int VFS_FILE_IS_LINK
A flag to denote that the file is a link.
Field Value:
64

VFS_FILE_READ_ONLY

public static final int VFS_FILE_READ_ONLY
A flag to denote that the file is read only (or a directory).
Field Value:
1

VFS_FILE_SYSTEM

public static final int VFS_FILE_SYSTEM
A flag to denote that the file has the system attribute.
Field Value:
4

VFS_FILE_VOLUME_LABEL

public static final int VFS_FILE_VOLUME_LABEL
A flag to denote that the file is a volume label.
Field Value:
8

Constructor Details

FileReference

public FileReference(int i)
Constructs a new file reference object.
Parameters:
i - the file reference number.

Method Details

getFileReferenceAsInt

public int getFileReferenceAsInt()
Retreives the integer representing this file reference.
Returns:
the integer representing this file reference.

putToByteArray

public void putToByteArray(byte[] buffer)
Puts the file reference into an array of bytes. This method puts the file reference into the specified array starting at index 0.
Parameters:
buffer - the byte array to write the file reference to.

putToByteArray

public void putToByteArray(byte[] buffer,
                           int position)
Puts the file reference into an array of bytes.
Parameters:
buffer - the byte array to write the file reference to.
position - the location to write to in the array.