本文整理匯總了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();
}