本文整理汇总了Java中javolution.text.Cursor.setIndex方法的典型用法代码示例。如果您正苦于以下问题:Java Cursor.setIndex方法的具体用法?Java Cursor.setIndex怎么用?Java Cursor.setIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javolution.text.Cursor
的用法示例。
在下文中一共展示了Cursor.setIndex方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parse
import javolution.text.Cursor; //导入方法依赖的package包/类
public Date parse(CharArray text, Cursor cursor, Calendar calendar) {
cursor.setIndex(0);
calendar.set(Calendar.YEAR, TypeFormat.parseInt(text, cursor));
verifyCharacterAndAdvanceCursor(text, cursor, '-');
calendar.set(Calendar.MONTH, TypeFormat.parseInt(text, cursor) - 1);
verifyCharacterAndAdvanceCursor(text, cursor, '-');
calendar.set(Calendar.DAY_OF_MONTH, TypeFormat.parseInt(text, cursor));
verifyCharacterAndAdvanceCursor(text, cursor, 'T');
calendar.set(Calendar.HOUR_OF_DAY, TypeFormat.parseInt(text, cursor));
verifyCharacterAndAdvanceCursor(text, cursor, ':');
calendar.set(Calendar.MINUTE, TypeFormat.parseInt(text, cursor));
verifyCharacterAndAdvanceCursor(text, cursor, ':');
calendar.set(Calendar.SECOND, TypeFormat.parseInt(text, cursor));
verifyCharacterAndAdvanceCursor(text, cursor, '.');
calendar.set(Calendar.MILLISECOND, TypeFormat.parseInt(text, cursor));
verifyCharacterAndAdvanceCursor(text, cursor, 'Z');
return calendar.getTime();
}
示例2: loadData
import javolution.text.Cursor; //导入方法依赖的package包/类
public static <V extends Vector<?>> DataSet<V> loadData(FileInputStream in, VectorBuilder<? extends V> builder) throws IOException {
ByteWeightedArrayDataSet<V> data = new ByteWeightedArrayDataSet<V>(1000);
BufferedReader r = null;
try {
r = new BufferedReader(new InputStreamReader(in));
String line;
Cursor cursor = new Cursor();
while((line = r.readLine()) != null) {
cursor.setIndex(0);
byte c = TypeFormat.parseByte(line, cursor);
builder.clear();
while(cursor.skip(' ', line) && cursor.getIndex() < line.length()) {
int idx = TypeFormat.parseInt(line, cursor) - 1;
cursor.skip(':', line);
double val = TypeFormat.parseDouble(line, cursor);
builder.add(idx, val);
}
data.add(builder.build(), c);
}
}
finally {
if(r != null) {
r.close();
}
}
return data;
}
示例3: parse
import javolution.text.Cursor; //导入方法依赖的package包/类
@Override
public String parse(CharSequence csq, Cursor cursor) {
CharSequence tmp = csq.subSequence(cursor.getIndex(), csq.length());
cursor.setIndex(csq.length());
return tmp.toString();
}