mirror of
https://github.com/corda/corda.git
synced 2025-06-13 04:38:19 +00:00
more classpath progress
This commit is contained in:
23
classpath/java/io/StringReader.java
Normal file
23
classpath/java/io/StringReader.java
Normal file
@ -0,0 +1,23 @@
|
||||
package java.io;
|
||||
|
||||
public class StringReader extends Reader {
|
||||
private final String in;
|
||||
private int position = 0;
|
||||
|
||||
public StringReader(String in) {
|
||||
this.in = in;
|
||||
}
|
||||
|
||||
public int read(char[] b, int offset, int length) throws IOException {
|
||||
if (length > in.length() - position) {
|
||||
length = in.length() - position;
|
||||
if (length <= 0) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
in.getChars(position, length, b, offset);
|
||||
return length;
|
||||
}
|
||||
|
||||
public void close() throws IOException { }
|
||||
}
|
Reference in New Issue
Block a user