Java tutorial
/** * Copyright (c) 2009 Zauber S.A. <http://www.zauber.com.ar/> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package ar.com.zauber.labs.kraken.providers.wikipedia.apps.administrative; import java.io.IOException; import java.io.Writer; import org.apache.commons.lang.UnhandledException; import org.apache.commons.lang.Validate; /** * Writes a tab separated file * * @author Juan F. Codagnone * @since Sep 24, 2009 */ public class TabSeparatedWriter { private final Writer writer; /** constructor */ public TabSeparatedWriter(final Writer writer) { Validate.notNull(writer); this.writer = writer; } /** writes a line */ public final void write(final CharSequence... fields) { try { for (final CharSequence field : fields) { writer.append(field); writer.append('\t'); } writer.append('\n'); writer.flush(); } catch (final IOException e) { throw new UnhandledException(e); } } }