PageRenderTime 37ms CodeModel.GetById 9ms RepoModel.GetById 0ms app.codeStats 0ms

/hphp/runtime/ext/zlib/ext_zlib.php

https://gitlab.com/Blueprint-Marketing/hhvm
PHP | 402 lines | 80 code | 30 blank | 292 comment | 0 complexity | c2b7403eb3693e44dad8d03b2cc21f03 MD5 | raw file
  1. <?hh
  2. // @generated by docskel.php
  3. /**
  4. * Close an open gz-file pointer
  5. *
  6. * @param resource $zp - The gz-file pointer. It must be valid, and must
  7. * point to a file successfully opened by gzopen().
  8. *
  9. * @return bool -
  10. */
  11. <<__Native, __ParamCoerceModeFalse>>
  12. function gzclose(resource $zp): bool;
  13. /**
  14. * ( excerpt from http://docs.hhvm.com/manual/en/function.zlib-encode.php )
  15. *
  16. * Compress data with the specified encoding. Warning: This function is
  17. * currently not documented; only its argument list is available.
  18. *
  19. * @data mixed
  20. * @encoding mixed
  21. * @level mixed
  22. */
  23. <<__Native>>
  24. function zlib_encode(string $data, int $encoding, int $level = -1): mixed;
  25. /**
  26. * ( excerpt from http://docs.hhvm.com/manual/en/function.zlib-decode.php )
  27. *
  28. * Uncompress any raw/gzip/zlib encoded data. Warning: This function is
  29. * currently not documented; only its argument list is available.
  30. *
  31. * @data mixed
  32. * @max_decoded_len
  33. * mixed
  34. */
  35. <<__Native>>
  36. function zlib_decode(string $data, int $max_len = 0): mixed;
  37. /**
  38. * Compress a string
  39. *
  40. * @param string $data - The data to compress.
  41. * @param int $level - The level of compression. Can be given as 0 for no
  42. * compression up to 9 for maximum compression. If -1 is used, the
  43. * default compression of the zlib library is used which is 6.
  44. *
  45. * @return string - The compressed string or FALSE if an error occurred.
  46. */
  47. <<__Native>>
  48. function gzcompress(string $data, int $level = -1): mixed;
  49. /**
  50. * Decodes a gzip compressed string
  51. *
  52. * @param string $data - The data to decode, encoded by gzencode().
  53. * @param int $length - The maximum length of data to decode.
  54. *
  55. * @return string - The decoded string, or FALSE if an error occurred.
  56. */
  57. <<__Native>>
  58. function gzdecode(string $data,
  59. int $length = 0): mixed;
  60. /**
  61. * Deflate a string
  62. *
  63. * @param string $data - The data to deflate.
  64. * @param int $level - The level of compression. Can be given as 0 for no
  65. * compression up to 9 for maximum compression. If not given, the default
  66. * compression level will be the default compression level of the zlib
  67. * library.
  68. *
  69. * @return string - The deflated string or FALSE if an error occurred.
  70. */
  71. <<__Native>>
  72. function gzdeflate(string $data, int $level = -1): mixed;
  73. /**
  74. * Create a gzip compressed string
  75. *
  76. * @param string $data - The data to encode.
  77. * @param int $level - The level of compression. Can be given as 0 for no
  78. * compression up to 9 for maximum compression. If not given, the default
  79. * compression level will be the default compression level of the zlib
  80. * library.
  81. * @param int $encoding_mode - The encoding mode. Can be FORCE_GZIP (the
  82. * default) or FORCE_DEFLATE. Prior to PHP 5.4.0, using FORCE_DEFLATE
  83. * results in a standard zlib deflated string (inclusive zlib headers)
  84. * after a gzip file header but without the trailing crc32 checksum. In
  85. * PHP 5.4.0 and later, FORCE_DEFLATE generates RFC 1950 compliant
  86. * output, consisting of a zlib header, the deflated data, and an Adler
  87. * checksum.
  88. *
  89. * @return string - The encoded string, or FALSE if an error occurred.
  90. */
  91. <<__Native>>
  92. function gzencode(string $data,
  93. int $level = -1,
  94. int $encoding_mode = FORCE_GZIP): mixed;
  95. /**
  96. * Test for on a gz-file pointer
  97. *
  98. * @param resource $zp - The gz-file pointer. It must be valid, and must
  99. * point to a file successfully opened by gzopen().
  100. *
  101. * @return bool - Returns TRUE if the gz-file pointer is at EOF or an
  102. * error occurs; otherwise returns FALSE.
  103. */
  104. <<__Native, __ParamCoerceModeFalse>>
  105. function gzeof(resource $zp): bool;
  106. /**
  107. * Read entire gz-file into an array
  108. *
  109. * @param string $filename - The file name.
  110. * @param int $use_include_path - You can set this optional parameter to
  111. * 1, if you want to search for the file in the include_path too.
  112. *
  113. * @return array - An array containing the file, one line per cell.
  114. */
  115. <<__Native>>
  116. function gzfile(string $filename,
  117. int $use_include_path = 0): mixed;
  118. /**
  119. * Get character from gz-file pointer
  120. *
  121. * @param resource $zp - The gz-file pointer. It must be valid, and must
  122. * point to a file successfully opened by gzopen().
  123. *
  124. * @return string - The uncompressed character or FALSE on EOF (unlike
  125. * gzeof()).
  126. */
  127. <<__Native, __ParamCoerceModeFalse>>
  128. function gzgetc(resource $zp): mixed;
  129. /**
  130. * Get line from file pointer
  131. *
  132. * @param resource $zp - The gz-file pointer. It must be valid, and must
  133. * point to a file successfully opened by gzopen().
  134. * @param int $length - The length of data to get.
  135. *
  136. * @return string - The uncompressed string, or FALSE on error.
  137. */
  138. <<__Native, __ParamCoerceModeFalse>>
  139. function gzgets(resource $zp,
  140. int $length = 1024): mixed;
  141. /**
  142. * Get line from gz-file pointer and strip HTML tags
  143. *
  144. *
  145. * @param resource $zp - The gz-file pointer. It must be valid, and must
  146. * point to a file successfully opened by gzopen().
  147. * @param int $length - The length of data to get.
  148. * @param string $allowable_tags - You can use this optional parameter to
  149. * specify tags which should not be stripped.
  150. *
  151. * @return string - The uncompressed and striped string, or FALSE on
  152. * error.
  153. */
  154. <<__Native, __ParamCoerceModeFalse>>
  155. function gzgetss(resource $zp,
  156. int $length = 0,
  157. string $allowable_tags = ''): mixed;
  158. /**
  159. * Inflate a deflated string
  160. *
  161. * @param string $data - The data compressed by gzdeflate().
  162. * @param int $length - The maximum length of data to decode.
  163. *
  164. * @return string - The original uncompressed data or FALSE on error.
  165. * The function will return an error if the uncompressed data is more
  166. * than 32768 times the length of the compressed input data or more than
  167. * the optional parameter length.
  168. */
  169. <<__Native>>
  170. function gzinflate(string $data, int $length = 0): mixed;
  171. /**
  172. * Open gz-file
  173. *
  174. * @param string $filename - The file name.
  175. * @param string $mode - As in fopen() (rb or wb) but can also include a
  176. * compression level (wb9) or a strategy: f for filtered data as in wb6f,
  177. * h for Huffman only compression as in wb1h. (See the description of
  178. * deflateInit2 in zlib.h for more information about the strategy
  179. * parameter.)
  180. * @param int $use_include_path - You can set this optional parameter to
  181. * 1, if you want to search for the file in the include_path too.
  182. *
  183. * @return resource - Returns a file pointer to the file opened, after
  184. * that, everything you read from this file descriptor will be
  185. * transparently decompressed and what you write gets compressed. If
  186. * the open fails, the function returns FALSE.
  187. */
  188. <<__Native>>
  189. function gzopen(string $filename,
  190. string $mode,
  191. int $use_include_path = 0): mixed;
  192. /**
  193. * Output all remaining data on a gz-file pointer
  194. *
  195. *
  196. * @param resource $zp - The gz-file pointer. It must be valid, and must
  197. * point to a file successfully opened by gzopen().
  198. *
  199. * @return int - The number of uncompressed characters read from gz and
  200. * passed through to the input, or FALSE on error.
  201. */
  202. <<__Native, __ParamCoerceModeFalse>>
  203. function gzpassthru(resource $zp): mixed;
  204. /**
  205. * Alias of gzwrite()
  206. */
  207. function gzputs(resource $zp, string $string, int $length = 0): mixed {
  208. return gzwrite($zp, $string, $length);
  209. }
  210. /**
  211. * Binary-safe gz-file read
  212. *
  213. * @param resource $zp - The gz-file pointer. It must be valid, and must
  214. * point to a file successfully opened by gzopen().
  215. * @param int $length - The number of bytes to read.
  216. *
  217. * @return string - The data that have been read.
  218. */
  219. <<__Native, __ParamCoerceModeFalse>>
  220. function gzread(resource $zp,
  221. int $length = 0): mixed;
  222. /**
  223. * Rewind the position of a gz-file pointer
  224. *
  225. * @param resource $zp - The gz-file pointer. It must be valid, and must
  226. * point to a file successfully opened by gzopen().
  227. *
  228. * @return bool -
  229. */
  230. <<__Native, __ParamCoerceModeFalse>>
  231. function gzrewind(resource $zp): bool;
  232. /**
  233. * Seek on a gz-file pointer
  234. *
  235. * @param resource $zp - The gz-file pointer. It must be valid, and must
  236. * point to a file successfully opened by gzopen().
  237. * @param int $offset - The seeked offset.
  238. * @param int $whence - whence values are: SEEK_SET - Set position equal
  239. * to offset bytes. SEEK_CUR - Set position to current location plus
  240. * offset. If whence is not specified, it is assumed to be SEEK_SET.
  241. *
  242. * @return int - Upon success, returns 0; otherwise, returns -1. Note
  243. * that seeking past EOF is not considered an error.
  244. */
  245. <<__Native, __ParamCoerceModeFalse>>
  246. function gzseek(resource $zp,
  247. int $offset,
  248. int $whence = SEEK_SET): mixed;
  249. /**
  250. * Tell gz-file pointer read/write position
  251. *
  252. * @param resource $zp - The gz-file pointer. It must be valid, and must
  253. * point to a file successfully opened by gzopen().
  254. *
  255. * @return int - The position of the file pointer or FALSE if an error
  256. * occurs.
  257. */
  258. <<__Native, __ParamCoerceModeFalse>>
  259. function gztell(resource $zp): mixed;
  260. /**
  261. * Uncompress a compressed string
  262. *
  263. * @param string $data - The data compressed by gzcompress().
  264. * @param int $length - The maximum length of data to decode.
  265. *
  266. * @return string - The original uncompressed data or FALSE on error.
  267. * The function will return an error if the uncompressed data is more
  268. * than 32768 times the length of the compressed input data or more than
  269. * the optional parameter length.
  270. */
  271. <<__Native>>
  272. function gzuncompress(string $data, int $length = 0): mixed;
  273. /**
  274. * Binary-safe gz-file write
  275. *
  276. * @param resource $zp - The gz-file pointer. It must be valid, and must
  277. * point to a file successfully opened by gzopen().
  278. * @param string $string - The string to write.
  279. * @param int $length - The number of uncompressed bytes to write. If
  280. * supplied, writing will stop after length (uncompressed) bytes have
  281. * been written or the end of string is reached, whichever comes first.
  282. * Note that if the length argument is given, then the
  283. * magic_quotes_runtime configuration option will be ignored and no
  284. * slashes will be stripped from string.
  285. *
  286. * @return int - Returns the number of (uncompressed) bytes written to
  287. * the given gz-file stream.
  288. */
  289. <<__Native, __ParamCoerceModeFalse>>
  290. function gzwrite(resource $zp,
  291. string $string,
  292. int $length = 0): mixed;
  293. /**
  294. * Output a gz-file
  295. *
  296. * @param string $filename - The file name. This file will be opened from
  297. * the filesystem and its contents written to standard output.
  298. * @param int $use_include_path - You can set this optional parameter to
  299. * 1, if you want to search for the file in the include_path too.
  300. *
  301. * @return int - Returns the number of (uncompressed) bytes read from the
  302. * file. If an error occurs, FALSE is returned and unless the function
  303. * was called as @readgzfile, an error message is printed.
  304. */
  305. <<__Native>>
  306. function readgzfile(string $filename,
  307. int $use_include_path = 0): mixed;
  308. /**
  309. * This function compresses the given string using the nzlib data format, which
  310. * is primarily used for compressing and uncompressing memcache values.
  311. *
  312. * @param string $uncompressed - The uncompressed data
  313. *
  314. * @return string - The compressed data, or FALSE on error
  315. */
  316. <<__Native, __HipHopSpecific>>
  317. function nzcompress(string $uncompressed): mixed;
  318. /**
  319. * This function uncompresses the given string given that it is in the nzlib
  320. * data format, which is primarily used for compressing and uncompressing
  321. * memcache values
  322. *
  323. * @param string $compressed - The data compressed by nzcompress().
  324. *
  325. * @return string - The uncompressed data or FALSE on error
  326. */
  327. <<__Native, __HipHopSpecific>>
  328. function nzuncompress(string $compressed): mixed;
  329. /**
  330. * This function compresses the given string using the lz4lib data format, which
  331. * is primarily used for compressing and uncompressing memcache values.
  332. *
  333. * @param string $uncompressed - The uncompressed data
  334. *
  335. * @return string - The compressed data, or FALSE on error
  336. */
  337. <<__Native>>
  338. function lz4_compress(string $uncompressed, bool $high = false): mixed;
  339. /**
  340. * This function compresses the given string using the lz4lib data format, which
  341. * is primarily used for compressing and uncompressing memcache values.
  342. *
  343. * @param string $uncompressed - The uncompressed data
  344. *
  345. * @return string - The compressed data, or FALSE on error
  346. */
  347. <<__Native, __HipHopSpecific>>
  348. function lz4_hccompress(string $uncompressed): mixed;
  349. /**
  350. * This function uncompresses the given string given that it is in the lz4lib
  351. * data format, which is primarily used for compressing and uncompressing
  352. * memcache values
  353. *
  354. * @param string $compressed - The data compressed by lz4compress().
  355. *
  356. * @return string - The uncompressed data or FALSE on error
  357. */
  358. <<__Native>>
  359. function lz4_uncompress(string $compressed): mixed;
  360. /**
  361. * Implementation detail for zlib.inflate stream filter.
  362. *
  363. * Not a public API - ideally this would be in namespace __SystemLib, but that
  364. * isn't currently supported.
  365. */
  366. <<__NativeData("__SystemLib_ChunkedInflator")>>
  367. class __SystemLib_ChunkedInflator {
  368. <<__Native>>
  369. function eof(): bool;
  370. <<__Native>>
  371. function inflateChunk(string $chunk): string;
  372. }