[Japi-cvs] SF.net SVN: japi: [597] tools/jwget/trunk/src/net/sf/japi/jwget
Status: Beta
Brought to you by:
christianhujer
From: <chr...@us...> - 2007-08-27 18:21:49
|
Revision: 597 http://japi.svn.sourceforge.net/japi/?rev=597&view=rev Author: christianhujer Date: 2007-08-27 06:24:12 -0700 (Mon, 27 Aug 2007) Log Message: ----------- Changed JWGet to be a LogCommand. Modified Paths: -------------- tools/jwget/trunk/src/net/sf/japi/jwget/JWGet.java Added Paths: ----------- tools/jwget/trunk/src/net/sf/japi/jwget/JWGet.properties tools/jwget/trunk/src/net/sf/japi/jwget/JWGet_de.properties Modified: tools/jwget/trunk/src/net/sf/japi/jwget/JWGet.java =================================================================== --- tools/jwget/trunk/src/net/sf/japi/jwget/JWGet.java 2007-08-27 12:32:44 UTC (rev 596) +++ tools/jwget/trunk/src/net/sf/japi/jwget/JWGet.java 2007-08-27 13:24:12 UTC (rev 597) @@ -27,14 +27,16 @@ import java.net.URL; import java.net.URLConnection; import java.util.List; +import java.util.logging.Level; import net.sf.japi.io.args.ArgParser; -import net.sf.japi.io.args.BasicCommand; +import net.sf.japi.io.args.LogCommand; import org.jetbrains.annotations.NotNull; -/** WGet implementation in Java. +/** + * WGet implementation in Java. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -public class JWGet extends BasicCommand { +public class JWGet extends LogCommand { /** Size of the I/O buffer. */ private static final int BUF_SIZE = 8192; @@ -50,7 +52,7 @@ public int run(@NotNull final List<String> args) throws Exception { int returnCode = 0; if (args.size() == 0) { - System.err.println("Usage: JWGet url..."); + log(Level.SEVERE, "noarguments"); returnCode++; } final byte[] buf = new byte[BUF_SIZE]; @@ -62,7 +64,7 @@ try { final String location = con.getHeaderField("Content-Location"); final String outputFilename = new File((location != null ? new URL(url, location) : url).getFile()).getName(); - System.err.println(outputFilename); + log(Level.INFO, "writing", arg, outputFilename); final OutputStream out = new FileOutputStream(outputFilename); try { for (int bytesRead; (bytesRead = in.read(buf)) != -1; ) { @@ -75,7 +77,7 @@ in.close(); } } catch (final IOException e) { - System.err.println(e); + log(Level.WARNING, "cannotopen", arg, e); returnCode++; } } Added: tools/jwget/trunk/src/net/sf/japi/jwget/JWGet.properties =================================================================== --- tools/jwget/trunk/src/net/sf/japi/jwget/JWGet.properties (rev 0) +++ tools/jwget/trunk/src/net/sf/japi/jwget/JWGet.properties 2007-08-27 13:24:12 UTC (rev 597) @@ -0,0 +1,22 @@ +# +# JWGet is a simple Java implementation of the unix command wget. +# Copyright (C) 2007 Christian Hujer +# +# 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., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# + +cannotopen=Can''t open {0}, reason: {1}. +noarguments=No arguments given. +writing=Writing {0} to file "{1}". Property changes on: tools/jwget/trunk/src/net/sf/japi/jwget/JWGet.properties ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: tools/jwget/trunk/src/net/sf/japi/jwget/JWGet_de.properties =================================================================== --- tools/jwget/trunk/src/net/sf/japi/jwget/JWGet_de.properties (rev 0) +++ tools/jwget/trunk/src/net/sf/japi/jwget/JWGet_de.properties 2007-08-27 13:24:12 UTC (rev 597) @@ -0,0 +1,22 @@ +# +# JWGet is a simple Java implementation of the unix command wget. +# Copyright (C) 2007 Christian Hujer +# +# 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., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# + +cannotopen=Kann {0} nicht \xF6ffnen, Grund: {1}. +noarguments=Keine Argumente. +writing=Schreibe {0} in Datei "{1}". Property changes on: tools/jwget/trunk/src/net/sf/japi/jwget/JWGet_de.properties ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |