[Lutinutil-commits] r873 - trunk/lutinutil/src/main/java/org/codelutin/util
Author: tchemit Date: 2008-07-20 23:52:25 +0000 (Sun, 20 Jul 2008) New Revision: 873 Added: trunk/lutinutil/src/main/java/org/codelutin/util/PropertiesDateRemoveFilterStream.java Log: get from maven-i18n-plugin Added: trunk/lutinutil/src/main/java/org/codelutin/util/PropertiesDateRemoveFilterStream.java =================================================================== --- trunk/lutinutil/src/main/java/org/codelutin/util/PropertiesDateRemoveFilterStream.java (rev 0) +++ trunk/lutinutil/src/main/java/org/codelutin/util/PropertiesDateRemoveFilterStream.java 2008-07-20 23:52:25 UTC (rev 873) @@ -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.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); + } + } + +} \ No newline at end of file
participants (1)
-
tchemit@users.labs.libre-entreprise.org