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

de.rpgframework.genericrpg.persist.IntegerArrayConverter Maven / Gradle / Ivy

package de.rpgframework.genericrpg.persist;

import java.util.ArrayList;
import java.util.List;

import org.prelle.simplepersist.StringValueConverter;

/**
 * @author prelle
 *
 */
public class IntegerArrayConverter implements StringValueConverter {

	@Override
	public String write(int[] v) throws Exception {
		StringBuffer buf = new StringBuffer();
		for (int i=0; i0)
				buf.append(",");
//			if (v[i]!=0) {
				buf.append(v[i]);
//			}
		}
		return buf.toString();
	}

	@Override
	public int[] read(String v) throws Exception {
		v = v.trim();
		List vals = new ArrayList<>();

		StringBuffer buf = new StringBuffer();
		for (int i=0; i




© 2015 - 2025 Weber Informatics LLC | Privacy Policy