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

de.invation.code.toval.file.FileFormat Maven / Gradle / Ivy

package de.invation.code.toval.file;

import java.nio.charset.Charset;


public abstract class FileFormat {
	
	public static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8");
	protected Charset charset = DEFAULT_CHARSET;

	public FileFormat() {}
	
	public FileFormat(Charset charset)  throws IllegalArgumentException{
		setCharset(charset);
	}
	
	public Charset getCharset(){
		return this.charset;
	}
	
	public void setCharset(Charset charset) throws IllegalArgumentException{
		if(!supportsCharset(charset))
			throw new IllegalArgumentException("Charset not supported");
		this.charset = charset;
	}
	
	public abstract String getName();

	public abstract boolean supportsCharset(Charset charset);
	
	public abstract String getFileExtension();
	
	public String getFileHeader(){
		return "";
	}
	
	public String getFileFooter(){
		return "";
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy