Index: maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/util/PropertiesDateRemoveFilterStream.java diff -u /dev/null maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/util/PropertiesDateRemoveFilterStream.java:1.1 --- /dev/null Wed Feb 6 18:38:21 2008 +++ maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/util/PropertiesDateRemoveFilterStream.java Wed Feb 6 18:38:15 2008 @@ -0,0 +1,50 @@ +/* +* ##% Copyright (C) 2008 Code Lutin, Gabriel Landais +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2 +* of the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +* ##% */ +package org.codelutin.i18n.plugin.util; + +import java.io.FilterOutputStream; +import java.io.IOException; +import java.io.OutputStream; + +public class PropertiesDateRemoveFilterStream extends FilterOutputStream { + + private boolean firstLineOver; + char endChar; + + public PropertiesDateRemoveFilterStream(OutputStream out) { + super(out); + firstLineOver = false; + String lineSeparator = java.security.AccessController + .doPrivileged(new sun.security.action.GetPropertyAction( + "line.separator")); + endChar = lineSeparator.charAt(lineSeparator.length() - 1); + } + + @Override + public void write(int b) throws IOException { + if (!firstLineOver) { + char c = (char) b; + if (c == endChar) { + firstLineOver = true; + } + } else { + out.write(b); + } + } + +}