@@ -22,12 +22,14 @@ impl ByteArrayInputStream {
2222 JavaMethodProto :: new( "read" , "()I" , Self :: read_byte, Default :: default ( ) ) ,
2323 JavaMethodProto :: new( "close" , "()V" , Self :: close, Default :: default ( ) ) ,
2424 JavaMethodProto :: new( "skip" , "(J)J" , Self :: skip, Default :: default ( ) ) ,
25+ JavaMethodProto :: new( "mark" , "(I)V" , Self :: mark, Default :: default ( ) ) ,
2526 JavaMethodProto :: new( "reset" , "()V" , Self :: reset, Default :: default ( ) ) ,
2627 ] ,
2728 fields : vec ! [
2829 JavaFieldProto :: new( "buf" , "[B" , Default :: default ( ) ) ,
2930 JavaFieldProto :: new( "pos" , "I" , Default :: default ( ) ) ,
3031 JavaFieldProto :: new( "count" , "I" , Default :: default ( ) ) ,
32+ JavaFieldProto :: new( "mark" , "I" , Default :: default ( ) ) ,
3133 ] ,
3234 }
3335 }
@@ -145,11 +147,19 @@ impl ByteArrayInputStream {
145147 Ok ( len_to_skip)
146148 }
147149
150+ async fn mark ( jvm : & Jvm , _: & mut RuntimeContext , mut this : ClassInstanceRef < Self > , readlimit : i32 ) -> Result < ( ) > {
151+ tracing:: debug!( "java.io.ByteArrayInputStream::mark({:?}, {:?})" , & this, readlimit) ;
152+
153+ jvm. put_field ( & mut this, "mark" , "I" , readlimit) . await ?;
154+
155+ Ok ( ( ) )
156+ }
157+
148158 async fn reset ( jvm : & Jvm , _: & mut RuntimeContext , mut this : ClassInstanceRef < Self > ) -> Result < ( ) > {
149159 tracing:: debug!( "java.io.ByteArrayInputStream::reset({:?})" , & this) ;
150160
151- // TODO mark position
152- jvm. put_field ( & mut this, "pos" , "I" , 0 ) . await ?;
161+ let mark : i32 = jvm . get_field ( & this , " mark" , "I" ) . await ? ;
162+ jvm. put_field ( & mut this, "pos" , "I" , mark ) . await ?;
153163
154164 Ok ( ( ) )
155165 }
0 commit comments