本文整理汇总了Java中org.apache.commons.lang.text.StrTokenizer类的典型用法代码示例。如果您正苦于以下问题:Java StrTokenizer类的具体用法?Java StrTokenizer怎么用?Java StrTokenizer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StrTokenizer类属于org.apache.commons.lang.text包,在下文中一共展示了StrTokenizer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: propertiesFromString
import org.apache.commons.lang.text.StrTokenizer; //导入依赖的package包/类
/**
* Converts a String back to connection parameters.
* @param input String from configuration
* @return JDBC connection parameters
*/
public static Properties propertiesFromString(String input) {
if (input != null && !input.isEmpty()) {
Properties result = new Properties();
StrTokenizer propertyTokenizer = StrTokenizer.getCSVInstance(input);
StrTokenizer valueTokenizer = StrTokenizer.getCSVInstance();
valueTokenizer.setDelimiterChar('=');
while (propertyTokenizer.hasNext()) {
valueTokenizer.reset(propertyTokenizer.nextToken());
String[] values = valueTokenizer.getTokenArray();
if (values.length == 2) {
result.put(values[0], values[1]);
}
}
return result;
} else {
return null;
}
}
示例2: propertiesFromString
import org.apache.commons.lang.text.StrTokenizer; //导入依赖的package包/类
/**
* Converts a String back to connection parameters.
* @param input String from configuration
* @return JDBC connection parameters
*/
protected static Properties propertiesFromString(String input) {
if (input != null && !input.isEmpty()) {
Properties result = new Properties();
StrTokenizer propertyTokenizer = StrTokenizer.getCSVInstance(input);
StrTokenizer valueTokenizer = StrTokenizer.getCSVInstance();
valueTokenizer.setDelimiterChar('=');
while (propertyTokenizer.hasNext()){
valueTokenizer.reset(propertyTokenizer.nextToken());
String[] values = valueTokenizer.getTokenArray();
if (values.length==2) {
result.put(values[0], values[1]);
}
}
return result;
} else {
return null;
}
}
示例3: createFromString
import org.apache.commons.lang.text.StrTokenizer; //导入依赖的package包/类
/**
* @param proxysettings
* String to convert
* @return
* @throws Exception
*/
public static ProxyItem createFromString( String proxysettings) throws Exception{
ProxyItem returnvalue = null;
try {
StrTokenizer tokenizer = new StrTokenizer(proxysettings, DELIMITER);
String[] tokenArray = tokenizer.getTokenArray();
String name = tokenArray[0];
String host = tokenArray[1];
int port = Integer.parseInt(tokenArray[2]);
returnvalue = new ProxyItem(host, port, name, true);
} catch (Exception e) {
throw new Exception("Error while parsing proxysettings", e);
}
return returnvalue;
}
示例4: init
import org.apache.commons.lang.text.StrTokenizer; //导入依赖的package包/类
private void init() {
rootItems.clear();
String configName = AppContext.getProperty(MENU_CONFIG_XML_PROP);
StrTokenizer tokenizer = new StrTokenizer(configName);
for (String location : tokenizer.getTokenArray()) {
Resource resource = resources.getResource(location);
if (resource.exists()) {
InputStream stream = null;
try {
stream = resource.getInputStream();
Element rootElement = Dom4j.readDocument(stream).getRootElement();
loadMenuItems(rootElement, null);
} catch (IOException e) {
throw new RuntimeException(e.getMessage(), e);
} finally {
IOUtils.closeQuietly(stream);
}
} else {
log.warn("Resource " + location + " not found, ignore it");
}
}
}
示例5: _registerAppComponents
import org.apache.commons.lang.text.StrTokenizer; //导入依赖的package包/类
protected void _registerAppComponents() {
String configName = AppContext.getProperty(WEB_COMPONENTS_CONFIG_XML_PROP);
StrTokenizer tokenizer = new StrTokenizer(configName);
for (String location : tokenizer.getTokenArray()) {
Resource resource = resources.getResource(location);
if (resource.exists()) {
InputStream stream = null;
try {
stream = resource.getInputStream();
_registerComponent(stream);
} catch (ClassNotFoundException | IOException e) {
throw new RuntimeException(e);
} finally {
IOUtils.closeQuietly(stream);
}
} else {
log.warn("Resource {} not found, ignore it", location);
}
}
}
示例6: init
import org.apache.commons.lang.text.StrTokenizer; //导入依赖的package包/类
protected void init() {
StopWatch initTiming = new Slf4JStopWatch("ViewRepository.init." + getClass().getSimpleName());
storage.clear();
readFileNames.clear();
String configName = AppContext.getProperty("cuba.viewsConfig");
if (!StringUtils.isBlank(configName)) {
Element rootElem = DocumentHelper.createDocument().addElement("views");
StrTokenizer tokenizer = new StrTokenizer(configName);
for (String fileName : tokenizer.getTokenArray()) {
addFile(rootElem, fileName);
}
checkDuplicates(rootElem);
for (Element viewElem : Dom4j.elements(rootElem, "view")) {
deployView(rootElem, viewElem, new HashSet<>());
}
}
initTiming.stop();
}
示例7: initAppContext
import org.apache.commons.lang.text.StrTokenizer; //导入依赖的package包/类
protected void initAppContext() {
String configProperty = AppContext.getProperty(SPRING_CONTEXT_CONFIG);
if (StringUtils.isBlank(configProperty)) {
throw new IllegalStateException("Missing " + SPRING_CONTEXT_CONFIG + " application property");
}
StrTokenizer tokenizer = new StrTokenizer(configProperty);
String[] locations = tokenizer.getTokenArray();
replaceLocationsFromConf(locations);
ApplicationContext appContext = createApplicationContext(locations);
AppContext.Internals.setApplicationContext(appContext);
Events events = AppBeans.get(Events.NAME);
events.publish(new AppContextInitializedEvent(appContext));
log.debug("AppContext initialized");
}
示例8: _registerWindowLoaders
import org.apache.commons.lang.text.StrTokenizer; //导入依赖的package包/类
protected void _registerWindowLoaders() {
String configName = AppContext.getProperty(DESKTOP_COMPONENTS_CONFIG_XML_PROP);
StrTokenizer tokenizer = new StrTokenizer(configName);
for (String location : tokenizer.getTokenArray()) {
Resource resource = resources.getResource(location);
if (resource.exists()) {
InputStream stream = null;
try {
stream = resource.getInputStream();
Element rootElement = Dom4j.readDocument(stream)
.getRootElement();
_loadWindowLoaders(rootElement);
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
IOUtils.closeQuietly(stream);
}
} else {
log.warn("Resource {} not found, ignore it", location);
}
}
}
示例9: init
import org.apache.commons.lang.text.StrTokenizer; //导入依赖的package包/类
protected void init() {
String configName = AppContext.getProperty(CUBA_REST_JSON_TRANSFORMATION_CONFIG_PROP_NAME);
StrTokenizer tokenizer = new StrTokenizer(configName);
for (String location : tokenizer.getTokenArray()) {
Resource resource = resources.getResource(location);
if (resource.exists()) {
InputStream stream = null;
try {
stream = resource.getInputStream();
loadConfig(Dom4j.readDocument(stream).getRootElement());
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
IOUtils.closeQuietly(stream);
}
} else {
log.warn("Resource " + location + " not found, ignore it");
}
}
}
示例10: init
import org.apache.commons.lang.text.StrTokenizer; //导入依赖的package包/类
protected void init() {
String configName = AppContext.getProperty(CUBA_REST_QUERIES_CONFIG_PROP_NAME);
StrTokenizer tokenizer = new StrTokenizer(configName);
for (String location : tokenizer.getTokenArray()) {
Resource resource = resources.getResource(location);
if (resource.exists()) {
InputStream stream = null;
try {
stream = resource.getInputStream();
loadConfig(Dom4j.readDocument(stream).getRootElement());
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
IOUtils.closeQuietly(stream);
}
} else {
log.warn("Resource " + location + " not found, ignore it");
}
}
}
示例11: init
import org.apache.commons.lang.text.StrTokenizer; //导入依赖的package包/类
protected void init() {
String configName = AppContext.getProperty(CUBA_REST_SERVICES_CONFIG_PROP_NAME);
StrTokenizer tokenizer = new StrTokenizer(configName);
for (String location : tokenizer.getTokenArray()) {
Resource resource = resources.getResource(location);
if (resource.exists()) {
InputStream stream = null;
try {
stream = resource.getInputStream();
loadConfig(Dom4j.readDocument(stream).getRootElement());
} catch (IOException e) {
throw new RuntimeException("Error on parsing rest services config", e);
} finally {
IOUtils.closeQuietly(stream);
}
} else {
log.warn("Resource " + location + " not found, ignore it");
}
}
}
示例12: init
import org.apache.commons.lang.text.StrTokenizer; //导入依赖的package包/类
protected void init() {
String configName = AppContext.getProperty(CUBA_REST_SERVICES_CONFIG_PROP_NAME);
StrTokenizer tokenizer = new StrTokenizer(configName);
for (String location : tokenizer.getTokenArray()) {
Resource resource = resources.getResource(location);
if (resource.exists()) {
InputStream stream = null;
try {
stream = resource.getInputStream();
loadConfig(Dom4j.readDocument(stream).getRootElement());
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
IOUtils.closeQuietly(stream);
}
} else {
log.warn("Resource " + location + " not found, ignore it");
}
}
}
示例13: load
import org.apache.commons.lang.text.StrTokenizer; //导入依赖的package包/类
public CreditsLoader load() {
String configProperty = AppContext.getProperty("cuba.creditsConfig");
if (StringUtils.isBlank(configProperty)) {
log.info("Property cuba.creditsConfig is empty");
return this;
}
StrTokenizer tokenizer = new StrTokenizer(configProperty);
String[] locations = tokenizer.getTokenArray();
for (String location : locations) {
Resources resources = AppBeans.get(Resources.NAME);
String xml = resources.getResourceAsString(location);
if (xml == null) {
log.debug("Resource {} not found, ignore it", location);
continue;
}
Element rootElement = Dom4j.readDocument(xml).getRootElement();
loadLicenses(rootElement);
loadConfig(rootElement);
}
Collections.sort(items);
return this;
}
示例14: init
import org.apache.commons.lang.text.StrTokenizer; //导入依赖的package包/类
protected void init() {
rootItems.clear();
String configName = AppContext.getProperty(MENU_CONFIG_XML_PROP);
StrTokenizer tokenizer = new StrTokenizer(configName);
for (String location : tokenizer.getTokenArray()) {
Resource resource = resources.getResource(location);
if (resource.exists()) {
InputStream stream = null;
try {
stream = resource.getInputStream();
Element rootElement = Dom4j.readDocument(stream).getRootElement();
loadMenuItems(rootElement, null);
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
IOUtils.closeQuietly(stream);
}
} else {
log.warn("Resource " + location + " not found, ignore it");
}
}
}
示例15: compileSpecific
import org.apache.commons.lang.text.StrTokenizer; //导入依赖的package包/类
private void compileSpecific() {
Node<BasicPermissionTarget> root = new Node<>(
new BasicPermissionTarget("category:specific", getMessage("permissionConfig.specificRoot"), null));
specific = new Tree<>(root);
final String configName = AppContext.getProperty(PERMISSION_CONFIG_XML_PROP);
StrTokenizer tokenizer = new StrTokenizer(configName);
for (String location : tokenizer.getTokenArray()) {
Resource resource = resources.getResource(location);
if (resource.exists()) {
InputStream stream = null;
try {
stream = resource.getInputStream();
String xml = IOUtils.toString(stream, StandardCharsets.UTF_8);
compileSpecific(xml, root);
} catch (IOException e) {
throw new RuntimeException("Unable to read permission config", e);
} finally {
IOUtils.closeQuietly(stream);
}
} else {
log.warn("Resource {} not found, ignore it", location);
}
}
}