@@ -91,10 +91,6 @@ public function readByte()
9191 });
9292 }
9393
94- public function readNull (){
95- return $ this ->readByteAssert (0x00 );
96- }
97-
9894 public function readByteAssert ($ expect )
9995 {
10096 return $ this ->readByte ()->then (function ($ byte ) use ($ expect ) {
@@ -105,11 +101,6 @@ public function readByteAssert($expect)
105101 });
106102 }
107103
108- public function readChar ()
109- {
110- return $ this ->readLength (1 );
111- }
112-
113104 public function readStringNull ()
114105 {
115106 $ deferred = new Deferred ();
@@ -131,39 +122,6 @@ public function readStringNull()
131122 return $ deferred ->promise ();
132123 }
133124
134- public function readAssert ($ byteSequence )
135- {
136- $ deferred = new Deferred ();
137- $ pos = 0 ;
138-
139- $ that = $ this ;
140- $ this ->readLength (strlen ($ byteSequence ))->then (function ($ data ) use ($ deferred ) {
141- $ deferred ->resolve ($ data );
142- }, null , function ($ part ) use ($ byteSequence , &$ pos , $ deferred , $ that ) {
143- $ len = strlen ($ part );
144- $ expect = substr ($ byteSequence , $ pos , $ len );
145-
146- if ($ part === $ expect ) {
147- $ pos += $ len ;
148- } else {
149- $ deferred ->reject (new UnexpectedValueException ('Expected " ' .$ that ->escape ($ expect ).'", but got " ' .$ that ->escape ($ part ).'" ' ));
150- }
151- });
152- return $ deferred ->promise ();
153- }
154-
155- public function escape ($ bytes )
156- {
157- $ ret = '' ;
158- for ($ i = 0 , $ l = strlen ($ bytes ); $ i < $ l ; ++$ i ) {
159- if ($ i !== 0 ) {
160- $ ret .= ' ' ;
161- }
162- $ ret .= sprintf ('0x%02X ' , ord ($ bytes [$ i ]));
163- }
164- return $ ret ;
165- }
166-
167125 public function readBufferCallback (/* callable */ $ callable )
168126 {
169127 if (!is_callable ($ callable )) {
0 commit comments