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

org.simpleflatmapper.lightningcsv.parser.CharSequenceCharBuffer Maven / Gradle / Ivy

Go to download

Java library to map flat record - ResultSet, csv - to java object with minimum configuration and low footprint.

There is a newer version: 9.0.2
Show newest version
package org.simpleflatmapper.lightningcsv.parser;

public final class CharSequenceCharBuffer extends CharBuffer {

	public CharSequenceCharBuffer(final String str) {
		super(str.toCharArray(), str.length());
	}

	public CharSequenceCharBuffer(final CharSequence str) {
		super(toCharArray(str), str.length());
	}

	@Override
	public boolean isConstant() {
		return true;
	}

	@Override
	public final boolean shiftAndRead(int shiftFrom) {
		throw new UnsupportedOperationException();
	}

	private static char[] toCharArray(CharSequence charSequence) {
		if (charSequence instanceof String) {
			return ((String)charSequence).toCharArray();
		} else {
			char[] buffer = new char[charSequence.length()];for(int i = 0; i < buffer.length; i++) {
				buffer[i] = charSequence.charAt(i);
			}
			return buffer;
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy