Normalize copyright header.

This commit is contained in:
Christian P. MOMON 2014-02-04 18:28:48 +01:00
parent 7267581eeb
commit 5961bc7099
48 changed files with 1037 additions and 169 deletions

View file

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8" ?>
<project>
<owner></owner>
<copyright><![CDATA[Copyright (C) 2014 Christian Pierre MOMON
This file is part of Devinsy-utils.
Devinsy-utils 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 3 of the License, or
(at your option) any later version.
Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>]]></copyright>
<header contentId="org.eclipse.pde.fragmentManifest" excluded="true" />
<header contentId="org.eclipse.pde.pluginProperties" excluded="true" />
<header contentId="org.eclipse.pde.productFile" excluded="true" />
<header contentId="org.eclipse.jst.j2ee.appclientDD" excluded="true" />
<header contentId="org.eclipse.ant.core.antBuildFile" excluded="true" />
<header contentId="org.eclipse.core.runtime.xml" postBlankLines="0" lineFormat="false" preserveFirstLine="true">
<beginLine><![CDATA[<!--]]></beginLine>
<linePrefix><![CDATA[ ]]></linePrefix>
<endLine><![CDATA[-->]]></endLine>
<firstLinePattern><![CDATA[<\?xml version=.*\?>]]></firstLinePattern>
</header>
<header contentId="org.eclipse.pde.simpleCheatSheet" excluded="true" />
<header contentId="org.eclipse.jst.j2ee.webDD" excluded="true" />
<header contentId="org.eclipse.pde.compositeCheatSheet" excluded="true" />
<header contentId="org.eclipse.pde.schema" excluded="true" />
<header contentId="org.eclipse.pde.tocFile" excluded="true" />
<header contentId="org.eclipse.jst.j2ee.earDD" excluded="true" />
<header contentId="org.eclipse.pde.ctxHelpFile" excluded="true" />
<header contentId="org.eclipse.jdt.core.JARManifest" excluded="true" />
<header contentId="org.eclipse.pde.categoryManifest" excluded="true" />
<header contentId="org.eclipse.pde.buildProperties" excluded="true" />
<header contentId="org.eclipse.ui.views.log.log" excluded="true" />
<header contentId="org.eclipse.pde.siteManifest" excluded="true" />
<header contentId="org.eclipse.pde.targetFile" excluded="true" />
<header contentId="org.eclipse.pde.bundleManifest" excluded="true" />
<header contentId="org.eclipse.jst.j2ee.connectorDD" excluded="true" />
<header contentId="org.eclipse.pde.pluginManifest" excluded="true" />
<header contentId="org.eclipse.core.runtime.text" postBlankLines="0" lineFormat="true" preserveFirstLine="false">
<beginLine><![CDATA[#-------------------------------------------------------------------------------]]></beginLine>
<linePrefix><![CDATA[# ]]></linePrefix>
<endLine><![CDATA[#-------------------------------------------------------------------------------]]></endLine>
</header>
<header contentId="org.eclipse.jst.j2ee.ejbDD" excluded="true" />
<header contentId="org.eclipse.pde.featureManifest" excluded="true" />
<header contentId="org.eclipse.jdt.core.javaSource" postBlankLines="0" lineFormat="false" preserveFirstLine="false">
<beginLine><![CDATA[/**]]></beginLine>
<linePrefix><![CDATA[ * ]]></linePrefix>
<endLine><![CDATA[ */]]></endLine>
</header>
</project>

View file

@ -1,7 +1,20 @@
/**
* @author Christian Momon, June 2008.
* This file is free software under the terms of the GNU Library General Public License
* as published by the Free Software Foundation version 2 or any later version.
* Copyright (C) 2008-2010, 2013-2014 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util;

View file

@ -1,7 +1,20 @@
/**
* @author Christian Momon, June 2008.
* This file is free software under the terms of the GNU Library General Public License
* as published by the Free Software Foundation version 2 or any later version.
* Copyright (C) 2008-2010, 2013-2014 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util;

View file

@ -1,7 +1,20 @@
/**
* @author Christian Momon, June 2010.
* This file is free software under the terms of the GNU Library General Public License
* as published by the Free Software Foundation version 2 or any later version.
* Copyright (C) 2010, 2013-2014 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util;

View file

@ -1,7 +1,20 @@
/**
* @author Christian Momon, June 2010.
* This file is free software under the terms of the GNU Library General Public License
* as published by the Free Software Foundation version 2 or any later version.
* Copyright (C) 2010, 2013-2014 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util;

View file

@ -1,8 +1,20 @@
/*
* @author Christian Momon, 2006-2010
* This file is free software under the terms of the GNU Library General Public License
* as published by the Free Software Foundation version 2 or any later version.
/**
* Copyright (C) 2006, 2010, 2013-2014 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util;

View file

@ -1,3 +1,21 @@
/**
* Copyright (C) 2010, 2013-2014 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util;
import java.io.File;

View file

@ -1,3 +1,21 @@
/**
* Copyright (C) 2010, 2013-2014 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util;
import java.io.File;
@ -163,7 +181,7 @@ public class FileIterator extends Vector<FileIteratorState> implements Iterator<
{
String result;
if (pattern == null)
if (this.pattern == null)
{
result = ".*";
}

View file

@ -1,3 +1,21 @@
/**
* Copyright (C) 2010, 2013-2014 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util;
import java.io.File;
@ -139,6 +157,6 @@ public class FileIteratorState implements Iterator<File>
*/
public void reset()
{
currentIndex = 0;
this.currentIndex = 0;
}
}

View file

@ -1,3 +1,21 @@
/**
* Copyright (C) 2008-2014 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util;
import java.io.BufferedReader;
@ -15,11 +33,7 @@ import java.net.URL;
/**
*
@author christian.momon@devinsy.fr, 2008-2013 copyright.
*
* This file is free software under the terms of the GNU Library General
* Public License as published by the Free Software Foundation version 3
* or any later version.
* @author cpm
*
*/
public class FileTools

View file

@ -1,15 +1,28 @@
/**
* Fraction class. Useful for display beautiful percentage value as string.
* Copyright (C) 2009-2010, 2013-2014 Christian Pierre MOMON
*
* @author Christian Momon, September 2009.
* This file is free software under the terms of the GNU Library General Public License
* as published by the Free Software Foundation version 2 or any later version.
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util;
/**
* Useful for display beautiful percentage value as string.
*
* */
* @author cpm
*/
public class Fraction
{
protected long numerator;

View file

@ -1,7 +1,20 @@
/**
* @author Christian Momon, September 2009.
* This file is free software under the terms of the GNU Library General Public License
* as published by the Free Software Foundation version 2 or any later version.
* Copyright (C) 2009-2010, 2013-2014 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util;

View file

@ -1,7 +1,20 @@
/**
* @author Christian Momon, September 2009.
* This file is free software under the terms of the GNU Library General Public License
* as published by the Free Software Foundation version 2 or any later version.
* Copyright (C) 2009-2010, 2013-2014 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util;
@ -30,16 +43,16 @@ public class SimpleAveragemeter
synchronized public void add(final long value)
{
// Manage the sum limit.
if ((this.sum > Long.MAX_VALUE / 2) && (cardinal % 2 == 0))
if ((this.sum > Long.MAX_VALUE / 2) && (this.cardinal % 2 == 0))
{
this.sum = this.sum / 2;
this.cardinal = this.cardinal / 2;
}
// Add the new value.
if (this.sum > MAX_ADD)
if (this.sum > this.MAX_ADD)
{
this.sum += MAX_ADD;
this.sum += this.MAX_ADD;
this.cardinal += 1;
}
else
@ -56,13 +69,13 @@ public class SimpleAveragemeter
{
long result;
if (cardinal == 0)
if (this.cardinal == 0)
{
result = 0;
}
else
{
result = sum / cardinal;
result = this.sum / this.cardinal;
}
//

View file

@ -1,7 +1,20 @@
/**
* @author Christian Momon, in June 2008.
* This file is free software under the terms of the GNU Library General Public License
* as published by the Free Software Foundation version 2 or any later version.
* Copyright (C) 2008-2010, 2013-2014 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util;

View file

@ -1,3 +1,21 @@
/**
* Copyright (C) 2010, 2013-2014 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util;
import java.io.ByteArrayOutputStream;

View file

@ -1,7 +1,20 @@
/**
* @author Christian Momon, June 2008.
* This file is free software under the terms of the GNU Library General Public License
* as published by the Free Software Foundation version 2 or any later version.
* Copyright (C) 2008-2010, 2013-2014 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util;
@ -87,7 +100,7 @@ public class StringConcatenator extends ArrayList<String>
{
StringConcatenator result;
this.add(LINE_SEPARATOR);
this.add(this.LINE_SEPARATOR);
result = this;

View file

@ -1,7 +1,20 @@
/**
* @author Christian Momon, June 2008.
* This file is free software under the terms of the GNU Library General Public License
* as published by the Free Software Foundation version 2 or any later version.
* Copyright (C) 2008-2010, 2013-2014 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util;

View file

@ -1,7 +1,20 @@
/**
* @author Christian Momon, 2013.
* This file is free software under the terms of the GNU Library General Public License
* as published by the Free Software Foundation version 2 or any later version.
* Copyright (C) 2013-2014 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util;
@ -25,17 +38,17 @@ public class StringListCharPosition
public int getCharIndex()
{
return charIndex;
return this.charIndex;
}
public int getLocalCharIndex()
{
return localCharIndex;
return this.localCharIndex;
}
public int getStringIndex()
{
return stringIndex;
return this.stringIndex;
}
public void setCharIndex(final int charIndex)

View file

@ -1,7 +1,20 @@
/**
* @author Christian Momon, March 2010.
* This file is free software under the terms of the GNU Library General Public License
* as published by the Free Software Foundation version 2 or any later version.
* Copyright (C) 2013-2014 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util;

View file

@ -1,3 +1,21 @@
/**
* Copyright (C) 2008-2010, 2013-2014 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util;
import java.util.Arrays;
@ -8,12 +26,7 @@ import org.apache.commons.lang3.StringUtils;
/**
*
@author christian.momon@devinsy.fr, June 2008, copyright.
*
* This file is free software under the terms of the GNU Library General
* Public License as published by the Free Software Foundation version 3
* or any later version.
*
* @author christian.momon@devinsy.fr
*/
public class ToolBox
{

View file

@ -1,3 +1,21 @@
/**
* Copyright (C) 2005-2010, 2013 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util.cmdexec;
import org.slf4j.Logger;
@ -8,6 +26,7 @@ import fr.devinsy.util.StringConcatenator;
/**
* We must use the isOver method on Gobblers because with short tasks the
* waitFor ends before the Gobbler read.
*
*/
public class CmdExec
{
@ -161,7 +180,15 @@ public class CmdExec
}
/**
* Command: not a shell command, it must be a executable program.
* Note: this code is inspired by an article of Michael C. Daconta published
* in JavaWorld Dec 29, 2000 (http://www.javaworld.com/article/2071275
* /core-java/when-runtime-exec---won -t.html?page=2).
*
* @param command
* not a shell command, it must be a executable program.
* @param outputGobbler
* @param errorGobbler
* @return
*/
public int run(final String[] command, final StreamGobbler outputGobbler, final StreamGobbler errorGobbler)
{
@ -176,19 +203,19 @@ public class CmdExec
Process proc = rt.exec(command);
// Any error message?
// Set a collector for error message.
errorGobbler.setInputStream(proc.getErrorStream());
// Any output?
// Set a collector for output message.
outputGobbler.setInputStream(proc.getInputStream());
// Kick them off
// Collect messages.
errorGobbler.start();
outputGobbler.start();
// Any error???
// Wait and manage the exit value.
this.exitValue = proc.waitFor();
logger.info("ExitValue: " + exitValue);
logger.info("ExitValue: " + this.exitValue);
// Sometimes, process ends before Gobblers read its outpout, so we
// must wait them.
@ -197,8 +224,9 @@ public class CmdExec
Thread.sleep(2);
}
out = outputGobbler.getStream();
err = errorGobbler.getStream();
// Store messsages.
this.out = outputGobbler.getStream();
this.err = errorGobbler.getStream();
}
catch (Exception exception)
{

View file

@ -1,3 +1,21 @@
/**
* Copyright (C) 2005-2008, 2010, 2013 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util.cmdexec;
import java.io.BufferedReader;
@ -124,7 +142,7 @@ public class StreamGobbler extends Thread
{
try
{
InputStreamReader isr = new InputStreamReader(is);
InputStreamReader isr = new InputStreamReader(this.is);
BufferedReader buffer = new BufferedReader(isr);
String line = null;
if (this.streamWay == NONE)
@ -138,14 +156,14 @@ public class StreamGobbler extends Thread
{
while ((line = buffer.readLine()) != null)
{
System.out.println(type + ">" + line);
System.out.println(this.type + ">" + line);
}
}
else if (this.streamWay == BUFFER)
{
while ((line = buffer.readLine()) != null)
{
stream.append(line + "\n");
this.stream.append(line + "\n");
}
}
else

View file

@ -1,3 +1,21 @@
/**
* Copyright (C) 2005-2008, 2010, 2013 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util.cmdexec;
import java.io.BufferedReader;
@ -9,8 +27,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* @deprecated
*/
@Deprecated
public class Wrapper
{
static private final Wrapper instance = new Wrapper();

View file

@ -1,14 +1,29 @@
/**
* Copyright (C) 2013-2014 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util.rss;
import java.util.HashMap;
import java.util.Locale;
/**
* @author christian.momon@devinsy.fr, 2013, copyright.
*
* This file is free software under the terms of the GNU Library General
* Public License as published by the Free Software Foundation version 3
* or any later version.
* @author christian.momon@devinsy.fr
*/
public class RSSCache
{

View file

@ -1,13 +1,28 @@
/**
* Copyright (C) 2013-2014 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util.rss;
import org.joda.time.DateTime;
/**
* @author christian.momon@devinsy.fr, 2013, copyright.
*
* This file is free software under the terms of the GNU Library General
* Public License as published by the Free Software Foundation version 3
* or any later version.
* @author christian.momon@devinsy.fr
*/
public class RSSElement
{
@ -85,7 +100,7 @@ public class RSSElement
public String[] getAttributes()
{
return attributes;
return this.attributes;
}
/**
@ -94,7 +109,7 @@ public class RSSElement
*/
public String getName()
{
return name;
return this.name;
}
/**
@ -103,7 +118,7 @@ public class RSSElement
*/
public String getValue()
{
return value;
return this.value;
}
public void setAttributes(final String[] attributes)

View file

@ -1,3 +1,21 @@
/**
* Copyright (C) 2013-2014 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util.rss;
import java.io.File;
@ -10,11 +28,8 @@ import java.io.Writer;
import fr.devinsy.util.xml.XMLWriter;
/**
* @author christian.momon@devinsy.fr, 2013, copyright.
*
* This file is free software under the terms of the GNU Library General
* Public License as published by the Free Software Foundation version 3
* or any later version.
* @author christian.momon@devinsy.fr
*/
public class RSSWriter
{
@ -96,7 +111,7 @@ public class RSSWriter
{
for (RSSElement element : elements)
{
out.writeTag(element.getName(), element.getValue(), element.getAttributes());
this.out.writeTag(element.getName(), element.getValue(), element.getAttributes());
}
}
}
@ -138,7 +153,7 @@ public class RSSWriter
{
for (RSSElement element : elements)
{
out.writeTag(element.getName(), element.getValue(), element.getAttributes());
this.out.writeTag(element.getName(), element.getValue(), element.getAttributes());
}
}

View file

@ -1,3 +1,21 @@
/**
* Copyright (C) 2006-2010, 2013-2014 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util.unix;
import java.io.File;

View file

@ -1,3 +1,21 @@
/**
* Copyright (C) 2006-2010, 2013-2014 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util.unix;
import java.util.Vector;
@ -110,9 +128,9 @@ public class EtcGroupFile extends CachedFile
{
String result;
groups = updatedGroups();
this.groups = updatedGroups();
result = groups.getLoginGroupsString(login);
result = this.groups.getLoginGroupsString(login);
//
return (result);

View file

@ -1,3 +1,21 @@
/**
* Copyright (C) 2006-2010, 2013-2014 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util.unix;
import java.io.BufferedReader;

View file

@ -1,3 +1,21 @@
/**
* Copyright (C) 2006-2010, 2013-2014 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util.unix;
import org.slf4j.Logger;

View file

@ -1,3 +1,21 @@
/**
* Copyright (C) 2006-2010, 2013-2014 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util.unix;
import java.io.BufferedReader;

View file

@ -1,3 +1,21 @@
/**
* Copyright (C) 2006-2010, 2013-2014 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util.unix;
import java.util.Vector;

View file

@ -1,3 +1,21 @@
/**
* Copyright (C) 2006-2010, 2013-2014 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util.unix;
import java.util.Iterator;

View file

@ -1,3 +1,21 @@
/**
* Copyright (C) 2006-2010, 2013-2014 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util.unix;
import java.io.File;

View file

@ -1,6 +1,23 @@
/**
* Copyright (C) 2006-2010, 2013-2014 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util.unix;
/**
*
*/

View file

@ -1,3 +1,21 @@
/**
* Copyright (C) 2006-2010, 2013-2014 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util.unix;
import java.util.Iterator;

View file

@ -1,3 +1,21 @@
/**
* Copyright (C) 2010, 2013-2014 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util.unix.acl;
/**

View file

@ -1,3 +1,21 @@
/**
* Copyright (C) 2010, 2013-2014 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util.unix.acl;
import java.util.Iterator;

View file

@ -1,6 +1,23 @@
/**
* Copyright (C) 2010, 2013-2014 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util.unix.acl;
/**
*
*/
@ -72,7 +89,7 @@ public class AclEntry
{
String result;
result = permission;
result = this.permission;
//
return (result);

View file

@ -1,3 +1,21 @@
/**
* Copyright (C) 2010, 2013-2014 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util.unix.acl;
import java.io.File;

View file

@ -1,3 +1,21 @@
/**
* Copyright (C) 2013-2014 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util.xml;
import java.util.ArrayList;
@ -16,31 +34,37 @@ import javax.xml.stream.events.Attribute;
* Public License as published by the Free Software Foundation version 3
* or any later version.
*/
public class XMLAttributes extends HashMap<String, Attribute> implements Iterable<Attribute> {
public class XMLAttributes extends HashMap<String, Attribute> implements Iterable<Attribute>
{
private static final long serialVersionUID = 8456469741805779474L;
/**
*
*/
public XMLAttributes() {
public XMLAttributes()
{
super();
}
/**
*
*/
public XMLAttributes(final int capacity) {
public XMLAttributes(final int capacity)
{
super(capacity);
}
/**
*
*/
public XMLAttributes(final Iterator<Attribute> source) {
public XMLAttributes(final Iterator<Attribute> source)
{
super();
if (source != null) {
while (source.hasNext()) {
if (source != null)
{
while (source.hasNext())
{
Attribute attribute = source.next();
add(attribute);
@ -51,7 +75,8 @@ public class XMLAttributes extends HashMap<String, Attribute> implements Iterabl
/**
*
*/
public XMLAttributes(final XMLAttributes source) {
public XMLAttributes(final XMLAttributes source)
{
super();
addAll(source);
}
@ -60,8 +85,10 @@ public class XMLAttributes extends HashMap<String, Attribute> implements Iterabl
*
* @param attribute
*/
public void add(final Attribute attribute) {
if (attribute != null) {
public void add(final Attribute attribute)
{
if (attribute != null)
{
put(attribute.getName().getLocalPart(), attribute);
}
}
@ -70,8 +97,10 @@ public class XMLAttributes extends HashMap<String, Attribute> implements Iterabl
*
* @param source
*/
public void addAll(final XMLAttributes source) {
for (Attribute attribute : source) {
public void addAll(final XMLAttributes source)
{
for (Attribute attribute : source)
{
this.add(attribute);
}
}
@ -81,7 +110,8 @@ public class XMLAttributes extends HashMap<String, Attribute> implements Iterabl
* @param label
* @return
*/
public Attribute getByLabel(final String label) {
public Attribute getByLabel(final String label)
{
Attribute result;
result = get(label);
@ -94,7 +124,8 @@ public class XMLAttributes extends HashMap<String, Attribute> implements Iterabl
*
*/
@Override
public Iterator<Attribute> iterator() {
public Iterator<Attribute> iterator()
{
Iterator<Attribute> result;
result = this.values().iterator();
@ -107,7 +138,8 @@ public class XMLAttributes extends HashMap<String, Attribute> implements Iterabl
*
* @return
*/
public Set<String> labels() {
public Set<String> labels()
{
Set<String> result;
result = this.keySet();
@ -120,7 +152,8 @@ public class XMLAttributes extends HashMap<String, Attribute> implements Iterabl
*
* @return
*/
public List<Attribute> toList() {
public List<Attribute> toList()
{
List<Attribute> result;
result = new ArrayList<Attribute>(values());

View file

@ -1,3 +1,21 @@
/**
* Copyright (C) 2013-2014 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util.xml;
/**
@ -7,7 +25,8 @@ package fr.devinsy.util.xml;
* Public License as published by the Free Software Foundation version 3
* or any later version.
*/
public class XMLBadFormatException extends Exception {
public class XMLBadFormatException extends Exception
{
private static final long serialVersionUID = 768256303984176512L;
@ -16,7 +35,8 @@ public class XMLBadFormatException extends Exception {
* @param code
* @param message
*/
public XMLBadFormatException(final String message) {
public XMLBadFormatException(final String message)
{
super(message);
}
@ -26,7 +46,8 @@ public class XMLBadFormatException extends Exception {
* @param message
* @param exception
*/
public XMLBadFormatException(final String message, final Exception exception) {
public XMLBadFormatException(final String message, final Exception exception)
{
super(message, exception);
}
}

View file

@ -1,3 +1,21 @@
/**
* Copyright (C) 2013-2014 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util.xml;
import java.io.File;

View file

@ -1,3 +1,21 @@
/**
* Copyright (C) 2013-2014 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util.xml;
import javax.xml.namespace.QName;
@ -10,15 +28,12 @@ import javax.xml.namespace.QName;
* Public License as published by the Free Software Foundation version 3
* or any later version.
*/
public class XMLTag {
public class XMLTag
{
public enum TagType {
HEADER,
START,
END,
EMPTY,
CONTENT,
FOOTER
public enum TagType
{
HEADER, START, END, EMPTY, CONTENT, FOOTER
}
private QName name;
@ -29,31 +44,38 @@ public class XMLTag {
/**
*
*/
public XMLTag(final QName name, final TagType type, final XMLAttributes attributes) {
public XMLTag(final QName name, final TagType type, final XMLAttributes attributes)
{
this.name = name;
this.type = type;
this.attributes = attributes;
this.content = null;
}
public XMLAttributes attributes() {
public XMLAttributes attributes()
{
return this.attributes;
}
public String getContent() {
return content;
public String getContent()
{
return this.content;
}
/**
*
* @return
*/
public String getLabel() {
public String getLabel()
{
String result;
if (this.name == null) {
if (this.name == null)
{
result = "";
} else {
}
else
{
result = this.name.getLocalPart();
}
@ -61,20 +83,25 @@ public class XMLTag {
return result;
}
public QName getName() {
return name;
public QName getName()
{
return this.name;
}
/**
*
* @return
*/
public String getNamespaceURI() {
public String getNamespaceURI()
{
String result;
if (this.name == null) {
if (this.name == null)
{
result = "";
} else {
}
else
{
result = this.name.getNamespaceURI();
}
@ -86,12 +113,16 @@ public class XMLTag {
*
* @return
*/
public String getPrefix() {
public String getPrefix()
{
String result;
if (this.name == null) {
if (this.name == null)
{
result = "";
} else {
}
else
{
result = this.name.getPrefix();
}
@ -99,19 +130,23 @@ public class XMLTag {
return result;
}
public TagType getType() {
return type;
public TagType getType()
{
return this.type;
}
public void setContent(final String content) {
public void setContent(final String content)
{
this.content = content;
}
public void setName(final QName name) {
public void setName(final QName name)
{
this.name = name;
}
public void setType(final TagType type) {
public void setType(final TagType type)
{
this.type = type;
}
}

View file

@ -1,3 +1,21 @@
/**
* Copyright (C) 2013-2014 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util.xml;
import java.io.BufferedReader;

View file

@ -1,3 +1,21 @@
/**
* Copyright (C) 2013-2014 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util.xml;
import java.io.File;

View file

@ -1,3 +1,21 @@
/**
* Copyright (C) 2013-2014 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util.xml;
import java.io.File;
@ -17,7 +35,8 @@ import javax.xml.stream.XMLStreamException;
* Public License as published by the Free Software Foundation version 3
* or any later version.
*/
public class XMLZipReader extends XMLReader {
public class XMLZipReader extends XMLReader
{
/**
*
@ -25,7 +44,8 @@ public class XMLZipReader extends XMLReader {
* @throws IOException
* @throws XMLStreamException
*/
public XMLZipReader(final File file) throws IOException, XMLStreamException {
public XMLZipReader(final File file) throws IOException, XMLStreamException
{
super();
XMLInputFactory factory = XMLInputFactory.newInstance();
@ -40,7 +60,8 @@ public class XMLZipReader extends XMLReader {
* @throws IOException
* @throws XMLStreamException
*/
public XMLZipReader(final InputStream source) throws IOException, XMLStreamException {
public XMLZipReader(final InputStream source) throws IOException, XMLStreamException
{
super();
XMLInputFactory factory = XMLInputFactory.newInstance();

View file

@ -1,3 +1,21 @@
/**
* Copyright (C) 2013-2014 Christian Pierre MOMON
*
* This file is part of Devinsy-utils.
*
* Devinsy-utils 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 3 of the License, or
* (at your option) any later version.
*
* Devinsy-utils 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 Devinsy-utils. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util.xml;
import java.io.File;
@ -34,11 +52,11 @@ public class XMLZipWriter extends XMLWriter
super();
this.zos = new ZipOutputStream(new FileOutputStream(file));
zos.setLevel(Deflater.BEST_COMPRESSION);
zos.setMethod(ZipOutputStream.DEFLATED);
zos.setComment("Generated by XMLZipWriter");
zos.putNextEntry(new ZipEntry(FileTools.setExtension(file, ".xml").getName()));
this.out = new PrintWriter(new OutputStreamWriter(zos, "UTF-8"));
this.zos.setLevel(Deflater.BEST_COMPRESSION);
this.zos.setMethod(ZipOutputStream.DEFLATED);
this.zos.setComment("Generated by XMLZipWriter");
this.zos.putNextEntry(new ZipEntry(FileTools.setExtension(file, ".xml").getName()));
this.out = new PrintWriter(new OutputStreamWriter(this.zos, "UTF-8"));
}
/**
@ -51,11 +69,11 @@ public class XMLZipWriter extends XMLWriter
super();
this.zos = new ZipOutputStream(new FileOutputStream(file));
zos.setLevel(Deflater.BEST_COMPRESSION);
zos.setMethod(ZipOutputStream.DEFLATED);
zos.setComment(generator);
zos.putNextEntry(new ZipEntry(FileTools.setExtension(file, ".xml").getName()));
this.out = new PrintWriter(new OutputStreamWriter(zos, "UTF-8"));
this.zos.setLevel(Deflater.BEST_COMPRESSION);
this.zos.setMethod(ZipOutputStream.DEFLATED);
this.zos.setComment(generator);
this.zos.putNextEntry(new ZipEntry(FileTools.setExtension(file, ".xml").getName()));
this.out = new PrintWriter(new OutputStreamWriter(this.zos, "UTF-8"));
}
/**
@ -67,13 +85,13 @@ public class XMLZipWriter extends XMLWriter
{
super();
this.zos = new ZipOutputStream(target);
zos.setLevel(Deflater.BEST_COMPRESSION);
zos.setMethod(ZipOutputStream.DEFLATED);
this.zos.setLevel(Deflater.BEST_COMPRESSION);
this.zos.setMethod(ZipOutputStream.DEFLATED);
if (generator != null)
{
zos.setComment(generator);
this.zos.setComment(generator);
}
this.out = new PrintWriter(new OutputStreamWriter(zos, "UTF-8"));
this.out = new PrintWriter(new OutputStreamWriter(this.zos, "UTF-8"));
}
/**
@ -85,14 +103,14 @@ public class XMLZipWriter extends XMLWriter
{
super();
this.zos = new ZipOutputStream(target);
zos.setLevel(Deflater.BEST_COMPRESSION);
zos.setMethod(ZipOutputStream.DEFLATED);
this.zos.setLevel(Deflater.BEST_COMPRESSION);
this.zos.setMethod(ZipOutputStream.DEFLATED);
if (generator != null)
{
zos.setComment(generator);
this.zos.setComment(generator);
}
openEntry(fileName);
this.out = new PrintWriter(new OutputStreamWriter(zos, "UTF-8"));
this.out = new PrintWriter(new OutputStreamWriter(this.zos, "UTF-8"));
}
/**