FIND YOUR NEXT FEW LINES

Results for “File operations & integrity”

Small, practical examples. Search by task or narrow things down below.

947 snippets foundClear filters
JavaFile operations & binary data

Load a small properties configuration

Java: Use a Reader to make the configuration character encoding explicit.

Java✓ Tested
JavaFile operations & binary data

Normalize relative path components

Java: Path.normalize removes redundant dot components without accessing the filesystem.

Java✓ Tested
PythonFile operations & archives

Read compressed text directly

Python: Open gzip data in text mode with an explicit encoding.

Python✓ Tested
C#File operations & paths

Replace a path extension

C#: Path.ChangeExtension transforms a path string without moving or creating a file.

C#✓ Tested
C++Filesystem operations

Set owner-only read and write permissions

C++: Replace ordinary permission bits with the requested owner permissions.

C++✓ Tested
JavaFile operations & binary data

Write and read binary bytes

Java: Use the byte-oriented Files methods when text encoding should not be involved.

Java✓ Tested
C++Filesystem operations

Write and read bytes without text conversion

C++: Use binary stream modes and check each I/O operation before consuming its result.

C++✓ Tested
C#File operations & paths

Write and read raw bytes

C#: Use the byte-oriented file APIs when no text encoding should be applied.

C#✓ Tested
RustErrors & optional values

Chain operations that may return None

Chain operations that may return None in a complete Rust program using the standard library.

Rust✓ Tested
Linux CommandsArchive integrity & packaging

Check the integrity of a gzip stream

Linux Commands: Use gzip -t to verify a compressed file without extracting it.

Linux Commands✓ Tested
CFile positioning & lifecycle

Measure a small seekable binary file

C: Seek to the end and inspect ftell, checking both operations for errors.

C✓ Tested
GitRestoring & revising local work

Add a forgotten file to the latest unpublished commit

Git: Stage the missing file before amending without changing the message.

Git✓ Tested