final class FileChannel extends BlockingChannel
A channel for reading, writing, mapping, and manipulating a file.
Unlike network channels, file channels are seekable with a current position that can be changed. The inherited read and write methods that do not take a position operate at the current position and update the position based on the number of bytes actually read or written.
- Self Type
- FileChannel
- Alphabetic
- By Inheritance
- FileChannel
- BlockingChannel
- Channel
- IOCloseable
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- final class BlockingFileOps extends GatheringByteOps with ScatteringByteOps
- type BlockingOps = BlockingFileOps
The blocking operations supported by this channel.
The blocking operations supported by this channel.
- Definition Classes
- FileChannel → BlockingChannel
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- val channel: java.nio.channels.FileChannel
- Attributes
- protected
- Definition Classes
- FileChannel → Channel
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def close(implicit trace: Trace): IO[IOException, Unit]
Closes this channel.
Closes this channel.
- Definition Classes
- Channel → IOCloseable
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def flatMapBlocking[R, E, A](f: (BlockingFileOps) => ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]
Puts this channel in blocking mode (if applicable) and performs a set of blocking operations.
Puts this channel in blocking mode (if applicable) and performs a set of blocking operations. Uses the standard ZIO
Blocking
service to run the provided effect on the blocking thread pool. Installs interrupt handling so that if the ZIO fiber is interrupted, this channel will be closed, which will unblock any currently blocked operations.- f
Given a
BlockingOps
argument appropriate for this channel type, produces an effect value containing blocking operations.
- Definition Classes
- FileChannel → BlockingChannel
- final def getClass(): Class[_ <: AnyRef]
- 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 isOpen(implicit trace: Trace): UIO[Boolean]
Tells whether or not this channel is open.
Tells whether or not this channel is open.
- Definition Classes
- Channel
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def nioBlocking[R, E, A](zioEffect: ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]
- Attributes
- protected
- Definition Classes
- BlockingChannel
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def position(newPosition: Long)(implicit trace: Trace): IO[IOException, Unit]
Sets this channel's position.
Sets this channel's position. Setting the position to a value that is greater than the file's current size is legal but does not change the size of the file. A later attempt to read bytes at such a position will immediately return an end-of-file indication. A later attempt to write bytes at such a position will cause the file to be grown to accommodate the new bytes; the values of any bytes between the previous end-of-file and the newly-written bytes are unspecified.
- newPosition
The new position, must be >= 0
- def position(implicit trace: Trace): IO[IOException, Long]
Returns the current value of this channel's position.
- def size(implicit trace: Trace): IO[IOException, Long]
Returns the current size of this channel's file.
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def tryLock(position: Long = 0L, size: Long = Long.MaxValue, shared: Boolean = false)(implicit trace: Trace): IO[IOException, Option[FileLock]]
Attempts to acquire a lock on the given region of this channel's file.
Attempts to acquire a lock on the given region of this channel's file. This method does not block. An invocation always returns immediately, either having acquired a lock on the requested region or having failed to do so. If it fails to acquire a lock because an overlapping lock is held by another program then it returns
None
. If it fails to acquire a lock for any other reason then an appropriate exception is thrown.- position
The position at which the locked region is to start, must be >= 0
- size
The size of the locked region; must be >= 0, and the sum position + size must be >= 0
- shared
true to request a shared lock, in which case this channel must be open for reading (and possibly writing); false to request an exclusive lock, in which case this channel must be open for writing (and possibly reading)
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()