All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.javanut.pronghorn.util.TopicUtil Maven / Gradle / Ivy

Go to download

Ring buffer based queuing utility for applications that require high performance and/or a small footprint. Well suited for embedded and stream based processing.

There is a newer version: 1.1.27
Show newest version
package com.javanut.pronghorn.util;

import java.io.IOException;

public class TopicUtil {

	//TODO: (easy short task) add unit tests for this.
	
	public static long extractLong(CharSequence topic, int levelIndex) {
		
		long result = 0;
		
		int limit = topic.length();
		int idx = scanForLevelPosition(topic, levelIndex, 0, limit);
		
		while (idx='0' && c<='9') {							
				result = ((result*10) + (c-'0'));				
			} else {
				//not numeric found, probably /
				break;
			}
			
		}
		return result;
	}
	
	public static CharSequence extractCharSequence(CharSequence topic, int levelIndex) {
		
		long result = 0;
		
		int limit = topic.length();
		int idx = scanForLevelPosition(topic, levelIndex, 0, limit);
		
		int start = idx;
		int length = 0;
		while (idx0 && idx




© 2015 - 2025 Weber Informatics LLC | Privacy Policy