Facebook Engineer?

This function is available as IO\Handle() in Facebook's www repository.

An interface for an IO stream

For example, an IO handle might be attached to a file, a network socket, or just an in-memory buffer.

HSL IO handles can be thought of as having a combination of behaviors - some of which are mutually exclusive - which are reflected in more-specific interfaces; for example:

  • Closeable
  • Seekable
  • Readable
  • Writable

These can be combined to arbitrary interfaces; for example, if you are writing a function that writes some data, you may want to take a IO\WriteHandle - or, if you read, write, and seek, IO\SeekableReadWriteHandle; only specify Closeable if your code requires that the close method is defined.

Some types of handle imply these behaviors; for example, all File\Handles are IO\SeekableHandles.

You probably want to start with one of:

Interface Synopsis

namespace HH\Lib\IO;

interface Handle {...}