public abstract class ProxyFileDescriptorCallback
extends Object



Callback that handles file system requests from ProxyFileDescriptor. All callback methods except for onRelease should throw ErrnoException with proper errno on errors. See errno(3) and OsConstants. Typical errnos are

Summary

Public constructors

ProxyFileDescriptorCallback()

Public methods

void onFsync()

Ensures all the written data are stored in permanent storage device.

long onGetSize()

Returns size of bytes provided by the file descriptor.

int onRead(long offset, int size, byte[] data)

Provides bytes read from file descriptor.

abstract void onRelease()

Invoked after the file is closed.

int onWrite(long offset, int size, byte[] data)

Handles bytes written to file descriptor.

Inherited methods

From class java.lang.Object

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait(long timeoutMillis)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

Public constructors

ProxyFileDescriptorCallback

public ProxyFileDescriptorCallback ()

Public methods

onFsync

public void onFsync ()

Ensures all the written data are stored in permanent storage device. For example, if it has data stored in on memory cache, it needs to flush data to storage device.

Throws
ErrnoException ErrnoException containing E constants in OsConstants.

onGetSize

public long onGetSize ()

Returns size of bytes provided by the file descriptor.

Returns
long Size of bytes.
Throws
ErrnoException ErrnoException containing E constants in OsConstants.

onRead

public int onRead (long offset, 
                int size, 
                byte[] data)

Provides bytes read from file descriptor. It needs to return exact requested size of bytes unless it reaches file end.

Parameters
offset long: Offset in bytes from the file head specifying where to read bytes. If a seek operation is conducted on the file descriptor, then a read operation is requested, the offset refrects the proper position of requested bytes.
size int: Size for read bytes.
data byte: Byte array to store read bytes.
Returns
int Size of bytes returned by the function.
Throws
ErrnoException ErrnoException containing E constants in OsConstants.

onRelease

public abstract void onRelease ()

Invoked after the file is closed.

onWrite

public int onWrite (long offset, 
                int size, 
                byte[] data)

Handles bytes written to file descriptor.

Parameters
offset long: Offset in bytes from the file head specifying where to write bytes. If a seek operation is conducted on the file descriptor, then a write operation is requested, the offset refrects the proper position of requested bytes.
size int: Size for write bytes.
data byte: Byte array to be written to somewhere.
Returns
int Size of bytes processed by the function.
Throws
ErrnoException ErrnoException containing E constants in OsConstants.

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2026-02-26 UTC.