0

PHP's stream API provides features to create custom "streams" within the zend engine. These stream features were designed to look and feel as if they were native Unix-like file descriptors where one can fopen, fwrite, fread, fseek, etc as if a normal file, but with custom handlers that could (for example) open a database connection on fopen, perform a SQL SELECT on fread, an SQL INSERT on fwrite, etc, creating a "high-level" database API which behaves like a normal file.

These stream handlers are best when written in C/C++, and PHP/Zend provide a native API for creating stream handlers.

Does Java VM provide a native API for this type of data handling?

JSON
  • 1,819
  • 20
  • 27
  • 1
    Do you need the streams to be real unix filesystem streams? (And what would you expect to happend, if running on Windows?). – MTilsted Oct 31 '14 at 18:57
  • The stream will be for a native ZeroMQ based network resource. ZeroMQ is available on many architectures and operating systems that run Java, and is pretty universal across applicable systems. – JSON Oct 31 '14 at 19:15
  • 1
    @JSON Not happy with [these](http://zeromq.org/bindings:java)? – Elliott Frisch Oct 31 '14 at 19:22

1 Answers1

1

It sounds like you are describing the java.nio and particularly the java.nio.channels packages. For example, the java.nio.channels.Channel Javadoc says (in part)

A channel represents an open connection to an entity such as a hardware device, a file, a network socket, or a program component that is capable of performing one or more distinct I/O operations, for example reading or writing.

Elliott Frisch
  • 198,278
  • 20
  • 158
  • 249