com.caucho.quercus.lib.file
Class StreamModule

java.lang.Object
  extended by com.caucho.quercus.module.AbstractQuercusModule
      extended by com.caucho.quercus.lib.file.StreamModule
All Implemented Interfaces:
QuercusModule

public class StreamModule
extends AbstractQuercusModule

Handling the PHP Stream API


Field Summary
static int PSFS_ERR_FATAL
           
static int PSFS_FEED_ME
           
static int PSFS_PASS_ON
           
static int STREAM_CLIENT_ASYNC_CONNECT
           
static int STREAM_CLIENT_CONNECT
           
static int STREAM_CLIENT_PERSISTENT
           
static int STREAM_FILTER_ALL
           
static int STREAM_FILTER_READ
           
static int STREAM_FILTER_WRITE
           
static int STREAM_REPORT_ERRORS
           
static int STREAM_SERVER_BIND
           
static int STREAM_SERVER_LISTEN
           
static int STREAM_URL_STAT_LINK
           
static int STREAM_URL_STAT_QUIET
           
static int STREAM_USE_PATH
           
 
Fields inherited from class com.caucho.quercus.module.AbstractQuercusModule
PHP_INI_ALL, PHP_INI_PERDIR, PHP_INI_SYSTEM, PHP_INI_USER
 
Constructor Summary
StreamModule()
           
 
Method Summary
 java.util.Map<StringValue,Value> getConstMap()
          Adds the constant to the PHP engine's constant map.
protected static ProtocolWrapper getWrapper(java.lang.String protocol)
           
static Value stream_context_create(Env env, ArrayValue options)
          Creates a stream context.
static Value stream_context_get_default(Env env, ArrayValue options)
          Returns the default stream context.
static Value stream_context_get_options(Env env, Value resource)
          Returns the options from a stream context.
static boolean stream_context_set_option(Env env, Value resource, StringValue wrapper, StringValue option, Value value)
          Set an options for a stream context.
static boolean stream_context_set_params(Env env, Value resource, ArrayValue value)
          Sets parameters for the context
static long stream_copy_to_stream(Env env, BinaryInput in, BinaryOutput out, int length, int offset)
          Copies from an input stream to an output stream
static Value stream_get_contents(Env env, BinaryInput in, long maxLen, long offset)
          Returns the rest of the file as a string
static Value stream_get_line(Env env, BinaryInput file, long length)
          Returns the next line
static Value stream_get_meta_data(Env env, BinaryStream stream)
          Returns the metadata of this stream.
static Value stream_get_transports(Env env)
          Returns the available transports.
static Value stream_get_wrappers(Env env)
          Returns the available wrappers.
static boolean stream_register_wrapper(Env env, StringValue protocol, java.lang.String className)
           
static boolean stream_set_blocking(Env env, Value stream, int mode)
          stream_set_blocking is stubbed since Quercus should wait for any stream (unless a non-web-server Quercus is developed.)
static boolean stream_set_timeout(Env env, Value stream, int seconds, int microseconds)
           
static int stream_set_write_buffer(Env env, BinaryOutput stream, int bufferSize)
          Sets the write buffer.
static SocketInputOutput stream_socket_client(Env env, java.lang.String remoteSocket, Value errorInt, Value errorStr, double timeout, int flags, StreamContextResource context)
           
static boolean stream_wrapper_register(Env env, StringValue protocol, java.lang.String className)
          Register a wrapper for a protocol.
static void stream_wrapper_register(StringValue protocol, ProtocolWrapper wrapper)
           
static boolean stream_wrapper_restore(Env env, StringValue protocol)
          Register a wrapper for a protocol.
static boolean stream_wrapper_unregister(Env env, StringValue protocol)
          Register a wrapper for a protocol.
 
Methods inherited from class com.caucho.quercus.module.AbstractQuercusModule
addConstant, addConstant, addConstant, getIniDefinitions, getLoadedExtensions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STREAM_FILTER_READ

public static final int STREAM_FILTER_READ
See Also:
Constant Field Values

STREAM_FILTER_WRITE

public static final int STREAM_FILTER_WRITE
See Also:
Constant Field Values

STREAM_FILTER_ALL

public static final int STREAM_FILTER_ALL
See Also:
Constant Field Values

PSFS_PASS_ON

public static final int PSFS_PASS_ON
See Also:
Constant Field Values

PSFS_FEED_ME

public static final int PSFS_FEED_ME
See Also:
Constant Field Values

PSFS_ERR_FATAL

public static final int PSFS_ERR_FATAL
See Also:
Constant Field Values

STREAM_USE_PATH

public static final int STREAM_USE_PATH
See Also:
Constant Field Values

STREAM_REPORT_ERRORS

public static final int STREAM_REPORT_ERRORS
See Also:
Constant Field Values

STREAM_CLIENT_ASYNC_CONNECT

public static final int STREAM_CLIENT_ASYNC_CONNECT
See Also:
Constant Field Values

STREAM_CLIENT_CONNECT

public static final int STREAM_CLIENT_CONNECT
See Also:
Constant Field Values

STREAM_CLIENT_PERSISTENT

public static final int STREAM_CLIENT_PERSISTENT
See Also:
Constant Field Values

STREAM_SERVER_BIND

public static final int STREAM_SERVER_BIND
See Also:
Constant Field Values

STREAM_SERVER_LISTEN

public static final int STREAM_SERVER_LISTEN
See Also:
Constant Field Values

STREAM_URL_STAT_LINK

public static final int STREAM_URL_STAT_LINK
See Also:
Constant Field Values

STREAM_URL_STAT_QUIET

public static final int STREAM_URL_STAT_QUIET
See Also:
Constant Field Values
Constructor Detail

StreamModule

public StreamModule()
Method Detail

getConstMap

public java.util.Map<StringValue,Value> getConstMap()
Adds the constant to the PHP engine's constant map.

Specified by:
getConstMap in interface QuercusModule
Overrides:
getConstMap in class AbstractQuercusModule
Returns:
the new constant chain

stream_context_create

public static Value stream_context_create(Env env,
                                          ArrayValue options)
Creates a stream context.


stream_context_get_options

public static Value stream_context_get_options(Env env,
                                               Value resource)
Returns the options from a stream context.


stream_context_get_default

public static Value stream_context_get_default(Env env,
                                               ArrayValue options)
Returns the default stream context.


stream_context_set_option

public static boolean stream_context_set_option(Env env,
                                                Value resource,
                                                StringValue wrapper,
                                                StringValue option,
                                                Value value)
Set an options for a stream context.


stream_context_set_params

public static boolean stream_context_set_params(Env env,
                                                Value resource,
                                                ArrayValue value)
Sets parameters for the context


stream_copy_to_stream

public static long stream_copy_to_stream(Env env,
                                         BinaryInput in,
                                         BinaryOutput out,
                                         int length,
                                         int offset)
Copies from an input stream to an output stream


stream_get_contents

public static Value stream_get_contents(Env env,
                                        BinaryInput in,
                                        long maxLen,
                                        long offset)
Returns the rest of the file as a string

Parameters:
filename - the file's name
useIncludePath - if true, use the include path
context - the resource context

stream_get_line

public static Value stream_get_line(Env env,
                                    BinaryInput file,
                                    long length)
Returns the next line


stream_get_meta_data

public static Value stream_get_meta_data(Env env,
                                         BinaryStream stream)
Returns the metadata of this stream. XXX: TODO


stream_get_transports

public static Value stream_get_transports(Env env)
Returns the available transports.


stream_get_wrappers

public static Value stream_get_wrappers(Env env)
Returns the available wrappers.


stream_register_wrapper

public static boolean stream_register_wrapper(Env env,
                                              StringValue protocol,
                                              java.lang.String className)

stream_set_blocking

public static boolean stream_set_blocking(Env env,
                                          Value stream,
                                          int mode)
stream_set_blocking is stubbed since Quercus should wait for any stream (unless a non-web-server Quercus is developed.)


stream_set_timeout

public static boolean stream_set_timeout(Env env,
                                         Value stream,
                                         int seconds,
                                         int microseconds)

stream_set_write_buffer

public static int stream_set_write_buffer(Env env,
                                          BinaryOutput stream,
                                          int bufferSize)
Sets the write buffer.


stream_socket_client

public static SocketInputOutput stream_socket_client(Env env,
                                                     java.lang.String remoteSocket,
                                                     Value errorInt,
                                                     Value errorStr,
                                                     double timeout,
                                                     int flags,
                                                     StreamContextResource context)

stream_wrapper_register

public static void stream_wrapper_register(StringValue protocol,
                                           ProtocolWrapper wrapper)

stream_wrapper_register

public static boolean stream_wrapper_register(Env env,
                                              StringValue protocol,
                                              java.lang.String className)
Register a wrapper for a protocol.


stream_wrapper_restore

public static boolean stream_wrapper_restore(Env env,
                                             StringValue protocol)
Register a wrapper for a protocol.


stream_wrapper_unregister

public static boolean stream_wrapper_unregister(Env env,
                                                StringValue protocol)
Register a wrapper for a protocol.


getWrapper

protected static ProtocolWrapper getWrapper(java.lang.String protocol)