æ¢ãã¦ã¿ãã IO_Bit ã¨ããã®ãããã¾ããã
string ããã£ã¤ã渡ãã¦ãinteger ãªã©ã«å¤æããã¤ã³ã¿ãã§ã¼ã¹ã£ã½ããresource ãã string ã«ããã¾ã§ã¯é¢ä¸ããªãã¨ãããã¨ãããã
以ä¸ãããããè¸ã¾ãã¦ã®ã¤ã³ã¿ãã§ã¼ã¹ã«ã¤ãã¦ã®èå¯ãè¿°ã¹ã¦ã¿ãã
string â byte[] ?
PHP ã¯åºæ¬çã« resource ããã®å ¥åºåãã¼ã¿ã¤ã³ã¿ãã§ã¼ã¹ã string ã§ããããã®ããããã¤ããªãã¼ã¿ãæ±ãããã«ã¯ string ã«å¯¾ã㦠pack / unpack ã ord ã使ãã®ãå®ç³ã£ã½ãã
PHP ã®æååã¯è¨èªä»æ§ãè¦ã㨠Java ã«ããã byte[] ã«è¿ã *1 ã¨ã¯è¨ããã¹ããªã¼ã ããã®ãã¼ã¿ã string ãçµç±ãããã¨ãå©ç¨è
ãæèããªãã¨ãããªãã®ã¯ããã¾ãã¹ãã¼ããããªãæ°ããããããresource ã渡ãããªãã¸ã§ã¯ãããç´æ¥ readXXX ãããããã®åã®ãã¼ã¿ã§å¾ãããã¤ã³ã¿ãã§ã¼ã¹ãæã¾ããã®ã§ã¯ãªããã¨æã£ã¦ããã(ã¤ã¾ã java.io ã£ã½ããã¤)
ã¨ã³ãã£ã¢ã³
ãã¤ããªãã¼ã¿ãæ±ãå ´åã«åºã¦ããããä¸ã¤ã®åé¡ãã¨ã³ãã£ã¢ã³ã§ããããã©ã¤ãã©ãªã«ãã£ã¦ããããæ±ããç°ãªã£ã¦ããã
java.io ã§ã¯ããã°ã¨ã³ãã£ã¢ã³æ±ºãæã¡ã«ãªã£ã¦ããããä¸è¿°ã® IO_Bit ã php-reader ã§ã¯ read ã¡ã½ããã®æ«å°¾ã« LE/BE ã¨ãã suffix ããããå¼ã³åºãæ¯ã«å©ç¨è ãæå®ããããã«ãªã£ã¦ããã
ãã£ãã LE/BE ãããã®ã¯ãããããã¨ã¯æããã©ãéã«ã¹ããªã¼ã ã®ä¸ã§é »ç¹ã«ã¨ã³ãã£ã¢ã³ãå¤ããå ´åãããã®ããæ°ã«ãªããã³ã³ã¹ãã©ã¯ã¿ã§ããã©ã«ãã®ã¨ã³ãã£ã¢ã³ãæå®ãã¦ããã°ããã®ã§ã¯ãªããã¨æããã