trait FileHandle[F[_]] extends AnyRef
Provides the ability to read/write/lock/inspect a file in the effect F
.
To construct a FileHandle
, use the methods in the fs2.io.file.pulls object.
- Source
- FileHandle.scala
- Alphabetic
- By Inheritance
- FileHandle
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- All
Type Members
-
abstract
type
Lock
Opaque type representing an exclusive lock on a file.
Abstract Value Members
-
abstract
def
force(metaData: Boolean): F[Unit]
Force any updates for the underlying file to storage.
Force any updates for the underlying file to storage.
- metaData
If true, also attempts to force file metadata updates to storage.
-
abstract
def
lock(position: Long, size: Long, shared: Boolean): F[Lock]
Acquire a lock on the specified region of the underlying file.
Acquire a lock on the specified region of the underlying file.
- position
the start of the region to lock.
- size
the size of the region to lock.
- shared
to request a shared lock across process boundaries (may be converted to an exclusive lock on some operating systems).
- returns
a lock object which can be used to unlock the region.
-
abstract
def
lock: F[Lock]
Acquire an exclusive lock on the underlying file.
Acquire an exclusive lock on the underlying file.
- returns
a lock object which can be used to unlock the file.
-
abstract
def
read(numBytes: Int, offset: Long): F[Option[Chunk[Byte]]]
Read the specified number of bytes at a particular offset.
Read the specified number of bytes at a particular offset.
- numBytes
the number of bytes to read.
- offset
the offset from the start of the file.
- returns
a number of bytes from the file (at most, numBytes in size).
-
abstract
def
size: F[Long]
Report the current size of the file.
Report the current size of the file.
- returns
the size of the file.
-
abstract
def
truncate(size: Long): F[Unit]
Truncate the underlying file to the specified size.
Truncate the underlying file to the specified size.
- size
the size of the file after truncation.
-
abstract
def
tryLock(position: Long, size: Long, shared: Boolean): F[Option[Lock]]
Attempt to acquire a lock on the specified region of the underlying file.
Attempt to acquire a lock on the specified region of the underlying file.
- position
the start of the region to lock.
- size
the size of the region to lock.
- shared
to request a shared lock across process boundaries (may be converted to an exclusive lock on some operating systems).
- returns
if the lock could be acquired, a lock object which can be used to unlock the region.
-
abstract
def
tryLock: F[Option[Lock]]
Attempt to acquire an exclusive lock on the underlying file.
Attempt to acquire an exclusive lock on the underlying file.
- returns
if the lock could be acquired, a lock object which can be used to unlock the file.
-
abstract
def
unlock(lock: Lock): F[Unit]
Unlock the (exclusive or regional) lock represented by the supplied
Lock
.Unlock the (exclusive or regional) lock represented by the supplied
Lock
.- lock
the lock object which represents the locked file or region.
-
abstract
def
write(bytes: Chunk[Byte], offset: Long): F[Int]
Write the specified bytes at a particular offset.
Write the specified bytes at a particular offset.
- bytes
the bytes to write to the
FileHandle
.- offset
the offset at which to write the bytes.
- returns
the number of bytes written.
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
def
+(other: String): String
- Implicit
- This member is added by an implicit conversion from FileHandle[F] to any2stringadd[FileHandle[F]] performed by method any2stringadd in scala.Predef.
- Definition Classes
- any2stringadd
-
def
->[B](y: B): (FileHandle[F], B)
- Implicit
- This member is added by an implicit conversion from FileHandle[F] to ArrowAssoc[FileHandle[F]] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @inline()
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
ensuring(cond: (FileHandle[F]) ⇒ Boolean, msg: ⇒ Any): FileHandle[F]
- Implicit
- This member is added by an implicit conversion from FileHandle[F] to Ensuring[FileHandle[F]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
ensuring(cond: (FileHandle[F]) ⇒ Boolean): FileHandle[F]
- Implicit
- This member is added by an implicit conversion from FileHandle[F] to Ensuring[FileHandle[F]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
ensuring(cond: Boolean, msg: ⇒ Any): FileHandle[F]
- Implicit
- This member is added by an implicit conversion from FileHandle[F] to Ensuring[FileHandle[F]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
ensuring(cond: Boolean): FileHandle[F]
- Implicit
- This member is added by an implicit conversion from FileHandle[F] to Ensuring[FileHandle[F]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
formatted(fmtstr: String): String
- Implicit
- This member is added by an implicit conversion from FileHandle[F] to StringFormat[FileHandle[F]] performed by method StringFormat in scala.Predef.
- Definition Classes
- StringFormat
- Annotations
- @inline()
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
→[B](y: B): (FileHandle[F], B)
- Implicit
- This member is added by an implicit conversion from FileHandle[F] to ArrowAssoc[FileHandle[F]] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc