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

com.javanut.pronghorn.util.AppendablesProxy 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 AppendablesProxy extends AppendableProxy {

	private final Appendable[] a;
	
	public static AppendablesProxy wrap(Appendable[] a) {
		return new AppendablesProxy(a);
	}
	
	public AppendablesProxy(Appendable[] a) {
		super(null);
		this.a = a;
	}
	
	@Override
	public AppendablesProxy append(CharSequence csq) {
		try {
			int i = a.length;
			while (--i>=0) {		
				a[i].append(csq);
			}
			return this;
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}

	@Override
	public AppendablesProxy append(CharSequence csq, int start, int end) {
		try {
			int i = a.length;
			while (--i>=0) {	
				a[i].append(csq, start, end);
			}
			return this;
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}

	@Override
	public AppendablesProxy append(char c) {
		try {
			int i = a.length;
			while (--i>=0) {	
				a[i].append(c);
			}
			return this;
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy