Example usage for org.apache.commons.text StringTokenizer StringTokenizer

List of usage examples for org.apache.commons.text StringTokenizer StringTokenizer

Introduction

In this page you can find the example usage for org.apache.commons.text StringTokenizer StringTokenizer.

Prototype

public StringTokenizer(final char[] input, final StringMatcher delim) 

Source Link

Document

Constructs a tokenizer splitting using the specified delimiter matcher.

Usage

From source file:org.silverpeas.core.silverstatistics.volume.service.SilverStatisticsService.java

/**
 * @param type the statistic type (Access, Size, Volume, Connexion)
 * @param data the value to put in statistic
 *//*from  w  ww.  j  a  v a 2s  .c  o m*/
@Override
public void putStats(StatType type, String data) {
    StringTokenizer stData = new StringTokenizer(data, SEPARATOR);
    List<String> dataArray = stData.getTokenList();
    if (myStatsConfig.isGoodDatas(type, dataArray)) {
        try (Connection myCon = DBUtil.openConnection()) {

            SilverStatisticsDAO.putDataStats(myCon, type, dataArray, myStatsConfig);
            if (!myCon.getAutoCommit()) {
                myCon.commit();
            }
        } catch (SQLException | StatisticsRuntimeException e) {
            SilverLogger.getLogger(this).error("typeOfStats={0}, dataArray={1}",
                    new Object[] { type, dataArray }, e);
        }
    } else {
        SilverLogger.getLogger(this).error("input data={0} for {1}", data, type);
    }
}