Skip to content

Commit 3a63bf7

Browse files
committed
Add ByteArrayInputStream::reset
1 parent d963be7 commit 3a63bf7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

java_runtime/src/classes/java/io/byte_array_input_stream.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ impl ByteArrayInputStream {
2121
JavaMethodProto::new("read", "()I", Self::read_byte, Default::default()),
2222
JavaMethodProto::new("close", "()V", Self::close, Default::default()),
2323
JavaMethodProto::new("skip", "(J)J", Self::skip, Default::default()),
24+
JavaMethodProto::new("reset", "()V", Self::reset, Default::default()),
2425
],
2526
fields: vec![
2627
JavaFieldProto::new("buf", "[B", Default::default()),
@@ -120,4 +121,13 @@ impl ByteArrayInputStream {
120121

121122
Ok(len_to_skip)
122123
}
124+
125+
async fn reset(jvm: &Jvm, _: &mut RuntimeContext, mut this: ClassInstanceRef<Self>) -> Result<()> {
126+
tracing::debug!("java.io.ByteArrayInputStream::reset({:?})", &this);
127+
128+
// TODO mark position
129+
jvm.put_field(&mut this, "pos", "I", 0).await?;
130+
131+
Ok(())
132+
}
123133
}

0 commit comments

Comments
 (0)