Liking cljdoc? Tell your friends :D

easy-nio.file

Wrapper around java.nio.channels.FileChannel.

Wrapper around java.nio.channels.FileChannel.
raw docstring

file-channelclj

(file-channel p & opts)

Opens a FileChannel at p (a Path) with the given opts (StandardOpenOption constants).

Examples: (file-channel p opt-read) (file-channel p opt-write opt-create opt-truncate)

Opens a FileChannel at `p` (a Path) with the given `opts`
(StandardOpenOption constants). 

Examples:
  (file-channel p opt-read)
  (file-channel p opt-write opt-create opt-truncate)
sourceraw docstring

force!clj

(force! ch metadata?)

Forces any updates to the file to be written to storage. If metadata? is true, file metadata (timestamps etc.) is also flushed. Returns ch.

Forces any updates to the file to be written to storage.
If `metadata?` is true, file metadata (timestamps etc.) is
also flushed. Returns `ch`.
sourceraw docstring

force-map!clj

(force-map! buf)

Flushes changes in a read-write mapped region to storage. No-op for read-only or copy-on-write mappings. Returns buf.

Flushes changes in a read-write mapped region to storage.
No-op for read-only or copy-on-write mappings. Returns `buf`.
sourceraw docstring

load!clj

(load! buf)

Loads the mapped region into physical memory where possible. Returns buf.

Loads the mapped region into physical memory where possible.
Returns `buf`.
sourceraw docstring

loaded?clj

(loaded? buf)

Returns true if the mapped region is likely to be resident in physical memory. This is only a hint and not guarantee.

Returns true if the mapped region is likely to be resident in
physical memory. This is only a hint and not guarantee.
sourceraw docstring

lock!clj

(lock! ch)

Acquires an exclusive lock on the entire file. Blocks until the lock is available. Returns a FileLock. Throws OverlappingFileLockException if the JVM already holds a lock that overlaps this region.

Acquires an exclusive lock on the entire file. Blocks until
the lock is available. Returns a FileLock.
Throws OverlappingFileLockException if the JVM already holds
a lock that overlaps this region.
sourceraw docstring

lock-region!clj

(lock-region! ch pos size shared?)

Acquires a lock on a region of the file. Blocks until available. pos — starting byte position size — number of bytes to lock shared? — true for a shared lock, false for exclusive.

Acquires a lock on a region of the file. Blocks until available.
`pos`    — starting byte position
`size`   — number of bytes to lock
`shared?` — true for a shared lock, false for exclusive.
sourceraw docstring

lock-valid?clj

(lock-valid? lock)

Returns true if lock is valid. A lock object remains valid until it is released or the associated file channel is closed, whichever comes first.

Returns true if `lock` is valid.
A lock object remains valid until it is released 
or the associated file channel is closed, 
whichever comes first. 
sourceraw docstring

mmapclj

(mmap ch mode pos size)

Maps a region of ch into memory. mode is one of: map-mode-read-only — shared read-only mapping map-mode-read-write — shared read-write mapping map-mode-private — private (copy on write) mapping pos is the starting file position, size is the region size in bytes. Returns a MappedByteBuffer. All easy-nio.buffer functions apply to it directly.

Maps a region of `ch` into memory. `mode` is one of:
  map-mode-read-only  — shared read-only mapping
  map-mode-read-write — shared read-write mapping
  map-mode-private    — private (copy on write) mapping
`pos` is the starting file position, `size` is the region size
in bytes. Returns a MappedByteBuffer. All easy-nio.buffer
functions apply to it directly.
sourceraw docstring

mmap-privateclj

(mmap-private ch pos size)

Maps size bytes of ch starting at pos as a copy-on-write mapping. Writes affect only the in-memory copy, not the file.

Maps `size` bytes of `ch` starting at `pos` as a copy-on-write
mapping. Writes affect only the in-memory copy, not the file.
sourceraw docstring

mmap-readclj

(mmap-read ch pos size)

Maps size bytes of ch starting at pos as a read-only mapping.

Maps `size` bytes of `ch` starting at `pos` as a read-only mapping.
sourceraw docstring

mmap-read-writeclj

(mmap-read-write ch pos size)

Maps size bytes of ch starting at pos as a read-write mapping.

Maps `size` bytes of `ch` starting at `pos` as a read-write mapping.
sourceraw docstring

opt-appendclj

source

opt-createclj

source

opt-create-newclj

source

opt-delete-on-closeclj

source

opt-dsyncclj

source

opt-readclj

source

opt-syncclj

source

opt-truncateclj

source

opt-writeclj

source

pathclj

(path first & more)

Constructs a Path from first and optional more path segments.

Constructs a Path from `first` and optional `more` path segments.
sourceraw docstring

positionclj

(position ch)

Returns the current file position.

Returns the current file position.
sourceraw docstring

read!clj

(read! ch buf)

Reads bytes from ch into buf at the channel's current position. Advances the position. Returns bytes read, or -1 at end-of-file.

Reads bytes from `ch` into `buf` at the channel's current position.
Advances the position. Returns bytes read, or -1 at end-of-file.
sourceraw docstring

read-at!clj

(read-at! ch buf pos)

Reads bytes from ch into buf starting at absolute file position pos. Does not affect the channel's current position.

Reads bytes from `ch` into `buf` starting at absolute file position
`pos`. Does not affect the channel's current position.
sourceraw docstring

release-lock!clj

(release-lock! lock)

Releases lock. Returns nil.

Releases `lock`. Returns nil.
sourceraw docstring

set-position!clj

(set-position! ch pos)

Sets the file position to pos. Returns ch.

Sets the file position to `pos`. Returns `ch`.
sourceraw docstring

shared-lock?clj

(shared-lock? lock)

Returns true if lock is a shared.

Returns true if `lock` is a shared.
sourceraw docstring

sizeclj

(size ch)

Returns the current size of the file in bytes.

Returns the current size of the file in bytes.
sourceraw docstring

transfer-from!clj

(transfer-from! ch src pos count)

Transfers bytes from src (a ReadableByteChannel) into ch. Writes up to count bytes starting at pos in ch. May transfer fewer bytes than requested. Returns bytes transferred.

Transfers bytes from `src` (a ReadableByteChannel) into `ch`.
Writes up to `count` bytes starting at `pos` in `ch`.
May transfer fewer bytes than requested. 
Returns bytes transferred.
sourceraw docstring

transfer-to!clj

(transfer-to! ch pos count dst)

Transfers bytes from ch to dst (a WritableByteChannel). Reads count bytes starting at pos in ch. May transfer fewer bytes than requested. Returns bytes transferred.

Transfers bytes from `ch` to `dst` (a WritableByteChannel).
Reads `count` bytes starting at `pos` in `ch`.
May transfer fewer bytes than requested. 
Returns bytes transferred.
sourceraw docstring

truncate!clj

(truncate! ch size)

Truncates the file to size bytes. If the current position exceeds size it is set to size. Returns ch.

Truncates the file to `size` bytes. If the current position
exceeds `size` it is set to `size`. Returns `ch`.
sourceraw docstring

try-lock!clj

(try-lock! ch)

Attempts to acquire an exclusive lock on the entire file without blocking. Returns a FileLock if successful, nil if the lock is unavailable. Throws OverlappingFileLockException if the JVM already holds an overlapping lock.

Attempts to acquire an exclusive lock on the entire file without
blocking. Returns a FileLock if successful, nil if the lock is
unavailable.
Throws OverlappingFileLockException if the JVM already holds
an overlapping lock.
sourceraw docstring

try-lock-region!clj

(try-lock-region! ch pos size shared?)

Attempts to acquire a lock on a region of the file without blocking. pos — starting byte position size — number of bytes to lock shared? — true for a shared lock, false for exclusive. Returns a FileLock if successful, nil if unavailable.

Attempts to acquire a lock on a region of the file without blocking.
`pos`     — starting byte position
`size`    — number of bytes to lock
`shared?` — true for a shared lock, false for exclusive.
Returns a FileLock if successful, nil if unavailable.
sourceraw docstring

write!clj

(write! ch buf)

Writes bytes from buf to ch at the channel's current position. Advances the position. Returns bytes written.

Writes bytes from `buf` to `ch` at the channel's current position.
Advances the position. Returns bytes written.
sourceraw docstring

write-at!clj

(write-at! ch buf pos)

Writes bytes from buf to ch at absolute file position pos. Does not affect the channel's current position.

Writes bytes from `buf` to `ch` at absolute file position `pos`.
Does not affect the channel's current position.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close