1 29 30 package com.caucho.quercus.lib.file; 31 32 import com.caucho.quercus.env.*; 33 import com.caucho.quercus.lib.UrlModule; 34 import com.caucho.quercus.lib.zlib.ZlibModule; 35 import com.caucho.util.L10N; 36 37 import java.util.logging.Logger ; 38 39 public class ZlibProtocolWrapper extends ProtocolWrapper { 40 private static final Logger log 41 = Logger.getLogger(ZlibProtocolWrapper.class.getName()); 42 private static final L10N L = new L10N(ZlibProtocolWrapper.class); 43 44 public ZlibProtocolWrapper() 45 { 46 } 47 48 public BinaryStream fopen(Env env, StringValue path, StringValue mode, 49 LongValue options) 50 { 51 boolean useIncludePath = 52 (options.toLong() & StreamModule.STREAM_USE_PATH) != 0; 53 54 ArrayValue components = 55 (ArrayValue) UrlModule.parse_url(env, path.toString()); 56 57 Value pathComponent = components.get(new StringValueImpl("path")); 58 59 if (pathComponent == UnsetValue.UNSET) { 60 log.info(L.l("no path component found in '{0}'", path.toString())); 61 return null; 62 } 63 64 return ZlibModule.gzopen(env, pathComponent.toString(), mode.toString(), 65 useIncludePath); 66 } 67 68 public Value opendir(Env env, StringValue path, LongValue flags) 69 { 70 env.warning(L.l("opendir not supported by protocol")); 71 72 return BooleanValue.FALSE; 73 } 74 75 public boolean unlink(Env env, StringValue path) 76 { 77 env.warning(L.l("unlink not supported by protocol")); 78 79 return false; 80 } 81 82 public boolean rename(Env env, StringValue path_from, StringValue path_to) 83 { 84 env.warning(L.l("rename not supported by protocol")); 85 86 return false; 87 } 88 89 public boolean mkdir(Env env, 90 StringValue path, LongValue mode, LongValue options) 91 { 92 env.warning(L.l("mkdir not supported by protocol")); 93 94 return false; 95 } 96 97 public boolean rmdir(Env env, StringValue path, LongValue options) 98 { 99 env.warning(L.l("rmdir not supported by protocol")); 100 101 return false; 102 } 103 104 public Value url_stat(Env env, StringValue path, LongValue flags) 105 { 106 env.warning(L.l("stat not supported by protocol")); 107 108 return BooleanValue.FALSE; 109 } 110 111 112 } 113 114 | Popular Tags |