[Asterisk-java-cvs] CVS: asterisk-java/src/java/net/sf/asterisk/fastagi/command GetDataCommand.java,
Brought to you by:
srt
From: Stefan R. <sr...@us...> - 2005-05-08 12:39:38
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/command In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2495/src/java/net/sf/asterisk/fastagi/command Modified Files: GetDataCommand.java Log Message: Changed GetDataCommand to include timeout and maxDigits only if needed. Index: GetDataCommand.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/command/GetDataCommand.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -p -r1.3 -r1.4 --- GetDataCommand.java 11 Mar 2005 23:15:39 -0000 1.3 +++ GetDataCommand.java 8 May 2005 12:39:29 -0000 1.4 @@ -32,6 +32,10 @@ public class GetDataCommand extends AGIC */ private static final long serialVersionUID = 3978141041352128820L; + private static final int DEFAULT_MAX_DIGITS = 1024; + private static final int DEFAULT_TIMEOUT = 0; + + /** * The name of the file to stream. */ @@ -59,8 +63,8 @@ public class GetDataCommand extends AGIC public GetDataCommand(String file) { this.file = file; - this.timeout = 0; - this.maxDigits = 1024; + this.timeout = DEFAULT_TIMEOUT; + this.maxDigits = DEFAULT_MAX_DIGITS; } /** @@ -76,7 +80,7 @@ public class GetDataCommand extends AGIC { this.file = file; this.timeout = timeout; - this.maxDigits = 1024; + this.maxDigits = DEFAULT_MAX_DIGITS; } /** @@ -176,6 +180,17 @@ public class GetDataCommand extends AGIC public String buildCommand() { + if (maxDigits == DEFAULT_MAX_DIGITS) + { + if (timeout == DEFAULT_TIMEOUT) + { + return "GET DATA " + escapeAndQuote(file); + } + else + { + return "GET DATA " + escapeAndQuote(file) + " " + timeout; + } + } return "GET DATA " + escapeAndQuote(file) + " " + timeout + " " + maxDigits; } |