make reading and writing to stdin/stdout work for most of the tools

git-svn-id: https://svn.verisignlabs.com/jdnssec/tools/trunk@241 4cbd57fe-54e5-0310-bd9a-f30fe5ea5e6e
This commit is contained in:
David Blacka 2011-02-09 23:58:54 +00:00
parent 73d930a850
commit faae654a23
3 changed files with 13 additions and 7 deletions

View File

@ -414,7 +414,7 @@ public class SignRRset {
} }
// default the output file, if not set. // default the output file, if not set.
if (state.outputfile == null) { if (state.outputfile == null && !state.inputfile.equals("-")) {
state.outputfile = state.inputfile + ".signed"; state.outputfile = state.inputfile + ".signed";
} }

View File

@ -809,7 +809,7 @@ public class SignZone
} }
// default the output file, if not set. // default the output file, if not set.
if (state.outputfile == null) if (state.outputfile == null && !state.zonefile.equals("-"))
{ {
if (zonename.isAbsolute()) if (zonename.isAbsolute())
{ {

View File

@ -56,11 +56,18 @@ public class ZoneUtils
* @throws IOException * @throws IOException
* if something goes wrong reading the zone file. * if something goes wrong reading the zone file.
*/ */
public static List readZoneFile(String zonefile, Name origin) public static List readZoneFile(String zonefile, Name origin) throws IOException
throws IOException
{ {
ArrayList records = new ArrayList(); ArrayList records = new ArrayList();
Master m = new Master(zonefile, origin); Master m;
if (zonefile.equals("-"))
{
m = new Master(System.in);
}
else
{
m = new Master(zonefile, origin);
}
Record r = null; Record r = null;
@ -81,8 +88,7 @@ public class ZoneUtils
* @param zonefile * @param zonefile
* the file to write to. If null or equal to "-", System.out is used. * the file to write to. If null or equal to "-", System.out is used.
*/ */
public static void writeZoneFile(List records, String zonefile) public static void writeZoneFile(List records, String zonefile) throws IOException
throws IOException
{ {
PrintWriter out = null; PrintWriter out = null;