io.inverno.mod.configuration.internal.parser.properties.StringProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of inverno-configuration Show documentation
Show all versions of inverno-configuration Show documentation
Inverno configuration module
/* Generated By:JavaCC: Do not edit this line. StringProvider.java Version 7.0 */
/* JavaCCOptions:KEEP_LINE_COLUMN=true */
package io.inverno.mod.configuration.internal.parser.properties;
import java.io.IOException;
public class StringProvider implements Provider {
String _string;
int _position = 0;
int _size;
public StringProvider(String string) {
_string = string;
_size = string.length();
}
@Override
public int read(char[] cbuf, int off, int len) throws IOException {
int numCharsOutstandingInString = _size - _position;
if (numCharsOutstandingInString == 0) {
return -1;
}
int numBytesInBuffer = cbuf.length;
int numBytesToRead = numBytesInBuffer -off;
numBytesToRead = numBytesToRead > len ? len : numBytesToRead;
if (numBytesToRead > numCharsOutstandingInString) {
numBytesToRead = numCharsOutstandingInString;
}
_string.getChars(_position, _position + numBytesToRead, cbuf, off);
_position += numBytesToRead;
return numBytesToRead;
}
@Override
public void close() throws IOException {
_string = null;
}
}
/* JavaCC - OriginalChecksum=b0ff887a8f30f0c3ef10f8b15641b40f (do not edit this line) */