Overriding mark and reset methods in emulated StringReader.
Change-Id: If7b9a6dbd324d8571d1c103bc4a9f66d86e8e3d6
diff --git a/user/super/com/google/gwt/emul/java/io/StringReader.java b/user/super/com/google/gwt/emul/java/io/StringReader.java
index 08d3241..d0e8a0f 100644
--- a/user/super/com/google/gwt/emul/java/io/StringReader.java
+++ b/user/super/com/google/gwt/emul/java/io/StringReader.java
@@ -15,12 +15,15 @@
*/
package java.io;
+import static javaemul.internal.InternalPreconditions.checkArgument;
+
/**
* Reads characters from a string.
*/
public class StringReader extends Reader {
private final String text;
private int position;
+ private int mark;
/**
* Constructs a reader which will read from the given string.
@@ -45,4 +48,20 @@
position += length;
return length;
}
+
+ @Override
+ public boolean markSupported() {
+ return true;
+ }
+
+ @Override
+ public void mark(int readAheadLimit) throws IOException {
+ checkArgument(readAheadLimit >= 0);
+ mark = position;
+ }
+
+ @Override
+ public void reset() throws IOException {
+ position = mark;
+ }
}