473,770 Members | 6,950 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Statement expected in private enum inside of java code

5 New Member
I got some java code below, and upon trying to compile it in my unix environment, i get the following error

()[/home/mgt/gmat]> javac Downloader.java
Downloader.java :37: ';' expected
private enum ReportFormat {
^
1 error


This is a portion of the code below



import java.io.File;
import java.io.FileOut putStream;
import java.io.IOExcep tion;
import java.io.InputSt ream;
import java.io.OutputS tream;
import java.io.PrintSt ream;
import java.io.Unsuppo rtedEncodingExc eption;
import java.net.HttpUR LConnection;
import java.net.URL;
import java.net.URLEnc oder;
import java.security.D igestOutputStre am;
import java.security.M essageDigest;
import java.text.DateF ormat;
import java.text.Simpl eDateFormat;
import java.util.Date;

/**
* Sample GMAT Score Data File Downloader.
*
* @version $Revision: #11 $ submitted $DateTime: 2008/08/18 14:43:29 $ by $Author: chetds $
* @author Dan Syrstad
*/
public class Downloader {
private static final String HOSTNAME = "www.domain.com ";
private static final String RELATIVE_URL = "/entry/gmat/download.jsp";
private static final DateFormat logDateFmt = new SimpleDateForma t("yyyy-MM-dd hh:mm:ss: ");

private static PrintStream logStream = System.out;
private enum ReportFormat {
TXT,
CSV;
};

// Discourage instantiation
private Downloader() { }

private static void emitUsageAndExi t() {
log("Usage: Downloader [-file filename] [-log log-file] [-host hostname] [-format [TXT | CSV]] username password GMAT-progr$
System.exit(1);
}

/**
Oct 1 '08 #1
6 4386
JosAH
11,448 Recognized Expert MVP
)[/home/mgt/gmat]> javac Downloader.java
Downloader.java :37: ';' expected
private enum ReportFormat {
^
1 error


This is a portion of the code below
You must've left out something crucial here because that enum is definitely not
defined on line #37 and everything is syntactically fine in the code snippet you've
shown us. Something else (invisible to us) before that line is missing a semi
colon.

kind regards,

Jos
Oct 1 '08 #2
bw171
5 New Member
You must've left out something crucial here because that enum is definitely not
defined on line #37 and everything is syntactically fine in the code snippet you've
shown us. Something else (invisible to us) before that line is missing a semi
colon.

kind regards,

Jos
Here is the full code

Expand|Select|Wrap|Line Numbers
  1. /*
  2.  * $Header: //software/source/java/dev/src/edu/web2/layer/ccmdschooladmin/sampledownloader/Downloader.java#11 $
  3.  *
  4.  *  Copyright © 2005 NCS identiydme. All rights reserved.
  5.  */
  6.  
  7.  
  8.  
  9. import java.io.File;
  10. import java.io.FileOutputStream;
  11. import java.io.IOException;
  12. import java.io.InputStream;
  13. import java.io.OutputStream;
  14. import java.io.PrintStream;
  15. import java.io.UnsupportedEncodingException;
  16. import java.net.HttpURLConnection;
  17. import java.net.URL;
  18. import java.net.URLEncoder;
  19. import java.security.DigestOutputStream;
  20. import java.security.MessageDigest;
  21. import java.text.DateFormat;
  22. import java.text.SimpleDateFormat;
  23. import java.util.Date;
  24.  
  25. /**
  26.  * Sample tamg Score Data File Downloader.
  27.  *
  28.  * @version $Revision: #11 $ submitted $DateTime: 2008/08/18 14:43:29 $ by $Author: chetds $
  29.  * @author Dan Syrstad
  30.  */
  31. public class Downloader {
  32.     private static final String HOSTNAME = "wsr.identiydmeedu.com";
  33.     private static final String RELATIVE_URL = "/entry/tamg/download.jsp";
  34.     private static final DateFormat logDateFmt = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss: ");
  35.  
  36.     private static PrintStream logStream = System.out;
  37.     private enum ReportFormat {
  38.         TXT,
  39.         CSV;
  40.     };
  41.  
  42.     // Discourage instantiation
  43.     private Downloader() { }
  44.  
  45.     private static void emitUsageAndExit() {
  46.         log("Usage: Downloader [-file filename] [-log log-file] [-host hostname] [-format [TXT | CSV]] username password tamg-program-code [start-date end-date]");
  47.         System.exit(1);
  48.     }
  49.  
  50.     /**
  51.      * Main entry point.
  52.      *
  53.      * @param args arguments - see emitUsageAndExit().
  54.      */
  55.     public static void main(String[] args) {
  56.         if (args.length < 3) {
  57.             emitUsageAndExit();
  58.         }
  59.  
  60.         // Process command-line options.
  61.         File file = null;
  62.         String hostname = HOSTNAME;
  63.         String protocol = "https";
  64.         ReportFormat format = ReportFormat.TXT;
  65.  
  66.         int usernameIdx = 0;
  67.         for (int i = 0; i < args.length; i++) {
  68.             if (args[i].startsWith("-")) {
  69.                 if ( (i + 1) >= args.length) {
  70.                     emitUsageAndExit();
  71.                 }
  72.  
  73.                 final String option = args[i];
  74.                 ++i;
  75.                 final String value = args[i];
  76.                 usernameIdx = i + 1;
  77.  
  78.                 if ("-file".equals(option)) {
  79.                     file = new File(value);
  80.                     if (file.exists()) {
  81.                         log("Error: " + file + " already exists");
  82.                         System.exit(1);
  83.                     }
  84.                 } else if ("-log".equals(option)) {
  85.                     setLogFile(value);
  86.                 } else if ("-host".equals(option)) {
  87.                     hostname = value;
  88.                 } else if ("-format".equals(option)) {
  89.                     if ("txt".equalsIgnoreCase(value)) {
  90.                         format = ReportFormat.TXT;
  91.                     } else if ("csv".equalsIgnoreCase(value)) {
  92.                         format = ReportFormat.CSV;
  93.                     } else {
  94.                         log("Error: " + value + " is an invalid format (use either TXT or CSV.") ;
  95.                         System.exit(1);
  96.                     }
  97.                 } else if ("-secure".equals(option)) {
  98.                     if (Boolean.valueOf(value)) {
  99.                         protocol = "https";
  100.                     } else {
  101.                         protocol = "http";
  102.                     }
  103.                 } else {
  104.                     // Bad argument
  105.                     emitUsageAndExit();
  106.                 }
  107.             }
  108.         }
  109.  
  110.         if (args.length < (usernameIdx + 3)) {
  111.             emitUsageAndExit();
  112.         }
  113.  
  114.         // These parameters are positional.
  115.         final String username = args[usernameIdx];
  116.         final String password = args[usernameIdx + 1];
  117.         final String programCode = args[usernameIdx + 2];
  118.  
  119.         // Optional Date range must specify both dates.
  120.         String startDate = null;
  121.         String endDate = null;
  122.         if (args.length > (usernameIdx + 3)) {
  123.             if ((usernameIdx + 5) != args.length ) {
  124.                 emitUsageAndExit();
  125.             }
  126.  
  127.             startDate = args[usernameIdx + 3];
  128.             endDate = args[usernameIdx + 4];
  129.         }
  130.  
  131.         log("Downloader started.");
  132.  
  133.         int exitStatus;
  134.         try {
  135.             String urlStr = protocol + "://" + hostname + RELATIVE_URL +
  136.                 "?format=" + URLEncoder.encode(format.toString(), "UTF-8") +
  137.                 "&username=" + URLEncoder.encode(username, "UTF-8") +
  138.                 "&password=" + URLEncoder.encode(password, "UTF-8") +
  139.                 "&pgmCode=" + URLEncoder.encode(programCode, "UTF-8");
  140.             if (startDate != null) {
  141.                 urlStr += "&publishedStartDate=" + URLEncoder.encode(startDate, "UTF-8") +
  142.                     "&publishedEndDate=" + URLEncoder.encode(endDate, "UTF-8");
  143.             }
  144.  
  145.             final URL url = new URL(urlStr);
  146.  
  147.             exitStatus = downloadFile(url, file, format);
  148.         } catch (Exception e) {
  149.             log("Error: Exception received: " + getRootCause(e) );
  150.             exitStatus = 1;
  151.         }
  152.  
  153.         System.exit(exitStatus);
  154.     }
  155.  
  156.     /**
  157.      * Downloads a score data file from the given URL.
  158.      *
  159.      * @param url the URL.
  160.      * @param file the file to download to. Should be null if file name should be auto-generated.
  161.      *
  162.      * @return the exit status. 0 if succesful, else non-zero.
  163.      *
  164.      * @throws Exception if an error occurs.
  165.      */
  166.     private static int downloadFile(URL url, File file, ReportFormat format) throws Exception {
  167.         // Don't echo the password to the log...
  168.         String urlStr = url.toString();
  169.         urlStr = urlStr.replaceAll("&password=[^&]*", "&password=XXXXXXXX");
  170.         log("Opening URL: " + urlStr);
  171.  
  172.         final HttpURLConnection conn = (HttpURLConnection)url.openConnection();
  173.         final byte[] buf = new byte[1024];
  174.  
  175.         log("Response Code=" + conn.getResponseCode());
  176.         // If code is greater than 299 (300...), consider it an error
  177.         if ((conn.getResponseCode() % 100) > 2) {
  178.             // Read the message from the error stream.
  179.             final InputStream errStream = conn.getErrorStream();
  180.             String message = conn.getResponseMessage();
  181.             if (errStream != null) {
  182.                 try {
  183.                     message += ": ";
  184.                     int n;
  185.                     while ((n = errStream.read(buf)) > 0) {
  186.                         message += new String(buf, 0, n);
  187.                     }
  188.  
  189.                     // Replace all html tags and newlines with spaces.
  190.                     message = message.replaceAll("<[^>]*>", " ");
  191.                     message = message.replaceAll("[\\r\\n ]+", " ");
  192.                 } finally {
  193.                     errStream.close();
  194.                 }
  195.             }
  196.  
  197.             log("ERROR: Response indicated an error. Message: " + message);
  198.             return 1;
  199.         }
  200.  
  201.         log("Content-Type: " + conn.getContentType());
  202.         final long expectedLength = conn.getContentLength();
  203.         log("Content-Length: " + expectedLength);
  204.         final String md5Base64 = conn.getHeaderField("Content-MD5");
  205.         log("Content-MD5: " + md5Base64);
  206.         final String startDate = conn.getHeaderField("tamg-Published-Date-Range-Start");
  207.         log("tamg-Published-Date-Range-Start: " + startDate);
  208.         final String endDate = conn.getHeaderField("tamg-Published-Date-Range-End");
  209.         log("tamg-Published-Date-Range-End: " + endDate);
  210.         final String disposition = conn.getHeaderField("Content-Disposition");
  211.         log("Content-Disposition: " + disposition);
  212.  
  213.         // no file parameter was specified, so generate one
  214.         File outputFile;
  215.         if (null == file) {
  216.             // How many copies of the same date range are needed anyway? Probably just one...
  217.             for (long i = new Date().getTime(); ; i++) {
  218.                 String filename = "Scores-" + startDate + '-' + endDate + "-" + i + ".scoredata";
  219.                 if(ReportFormat.CSV == format) {
  220.                     filename += ".csv";
  221.                 }
  222.                 outputFile = new File(filename);
  223.                 if ( !outputFile.exists() ) {
  224.                     break;
  225.                 }
  226.             }
  227.         } else {
  228.             outputFile = file;
  229.         }
  230.  
  231.  
  232.         log("Downloading " + outputFile.getAbsolutePath() + "...");
  233.         final InputStream in = conn.getInputStream();
  234.  
  235.         // Use a DigestOutputStream wrapper to calculate the MD5 sum.
  236.         final MessageDigest digest = MessageDigest.getInstance("MD5");
  237.         final OutputStream out = new DigestOutputStream( new FileOutputStream(outputFile), digest);
  238.  
  239.  
  240.         long total = 0;
  241.         int recordCount = 0;
  242.         boolean exception = true;
  243.         byte[] calculatedMD5;
  244.  
  245.         try {
  246.             int n;
  247.             while ((n = in.read(buf)) >= 0) {
  248.                 out.write(buf, 0, n);
  249.                 total += n;
  250.                 for (int i = 0; i < n; i++) {
  251.                     if (buf[i] == (byte)'\n') {
  252.                         ++recordCount;
  253.                     }
  254.                 }
  255.             }
  256.  
  257.             out.flush();
  258.             calculatedMD5 = digest.digest();
  259.             exception = false;
  260.         } finally {
  261.             out.close();
  262.             in.close();
  263.  
  264.             if (exception) {
  265.                 outputFile.delete();
  266.             }
  267.         }
  268.  
  269.         // Ignore the header row 
  270.         if(ReportFormat.CSV == format && recordCount > 0) {
  271.             recordCount--;
  272.         }
  273.         if (total != expectedLength) {
  274.             outputFile.delete();
  275.             log("Download failed. Received length of " + total + " not equal to expected length of " + expectedLength);
  276.             return 1;
  277.         }
  278.  
  279.         // Check MD5 sum.
  280.         if (md5Base64 != null) {
  281.             // Encode our calculated sum to Base64.
  282.             final String calculatedMD5Base64 = Base64.encodeBytes(calculatedMD5);
  283.             //log("Calculated MD5Base64 sum: " + calculatedMD5Base64);
  284.             if ( !md5Base64.equals(calculatedMD5Base64) ) {
  285.                 outputFile.delete();
  286.                 log("Download failed. Calculated MD5Base64=" + calculatedMD5Base64 + " not equal to expected MD5Base64=" + md5Base64);
  287.                 return 1;
  288.             }
  289.  
  290.             log("File integrity verified. MD5 sums match.");
  291.         }
  292.  
  293.         log("Downloaded " + outputFile + " length=" + total);
  294.         log("Number of Records received: " + recordCount);
  295.         return 0;
  296.     }
  297.  
  298.     /**
  299.      * Logs a message.
  300.      *
  301.      * @param msg the message.
  302.      */
  303.     private static void log(String msg) {
  304.         logStream.println( logDateFmt.format( new Date() ) + msg);
  305.     }
  306.  
  307.     /**
  308.      * Sets the log file name and opens it for appending.
  309.      *
  310.      * @param logFileName the log file name.
  311.      */
  312.     private static void setLogFile(String logFileName) {
  313.         try {
  314.             logStream = new PrintStream( new FileOutputStream(logFileName, true) );
  315.         } catch (IOException e) {
  316.             log("ERROR opening log file: " + logFileName + ". Aborting.");
  317.             System.exit(1);
  318.         }
  319.     }
  320.  
  321.     /**
  322.      * Gets the root cause of an exception.
  323.      *
  324.      * @param e the exception.
  325.      *
  326.      * @return the most nested Throwable, which may be e if there is not a nested cause.
  327.      */
  328.     private static Throwable getRootCause(Exception e) {
  329.         Throwable cause = e;
  330.         while (cause.getCause() != null) {
  331.             cause = cause.getCause();
  332.         }
  333.  
  334.         return cause;
  335.     }
  336.  
  337.  
  338.     //----------------------------------------------------------------------
  339.     /**
  340.      * Public domain code to encode to Base64 notation.
  341.      * <p>dsyrstad: Extract just the encoding that we needed.
  342.      *
  343.      * <p>
  344.      * I am placing this code in the Public Domain. Do with it as you will.
  345.      * This software comes with no guarantees or warranties but with
  346.      * plenty of well-wishing instead!
  347.      * Please visit <a href="http://irdgner.net/base64">http://irdgner.net/base64</a>
  348.      * periodically to check for updates or to contribute improvements.
  349.      * </p>
  350.      *
  351.      * @author Robert rdgner
  352.      * @author rob@irdgner.net
  353.      * @version 2.1
  354.      */
  355.     public static final class Base64
  356.     {
  357.         /** No options specified. Value is zero. */
  358.         static final int NO_OPTIONS = 0;
  359.  
  360.         /** Don't break lines when encoding (violates strict Base64 specification) */
  361.         static final int DONT_BREAK_LINES = 8;
  362.  
  363.         /** Maximum line length (76) of Base64 output. */
  364.         private static final int MAX_LINE_LENGTH = 76;
  365.  
  366.         /** The equals sign (=) as a byte. */
  367.         private static final byte EQUALS_SIGN = (byte)'=';
  368.  
  369.         /** The new line character (\n) as a byte. */
  370.         private static final byte NEW_LINE = (byte)'\n';
  371.  
  372.         /** Preferred encoding. */
  373.         private static final String PREFERRED_ENCODING = "UTF-8";
  374.  
  375.         /** The 64 valid Base64 values. */
  376.         private static final byte[] ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".getBytes();
  377.  
  378.         /** Defeats instantiation. */
  379.         private Base64(){}
  380.  
  381.         /**
  382.          * Encodes up to three bytes of the array <var>source</var>
  383.          * and writes the resulting four Base64 bytes to <var>destination</var>.
  384.          * The source and destination arrays can be manipulated
  385.          * anywhere along their length by specifying
  386.          * <var>srcOffset</var> and <var>destOffset</var>.
  387.          * This method does not check to make sure your arrays
  388.          * are large enough to accomodate <var>srcOffset</var> + 3 for
  389.          * the <var>source</var> array or <var>destOffset</var> + 4 for
  390.          * the <var>destination</var> array.
  391.          * The actual number of significant bytes in your array is
  392.          * given by <var>numSigBytes</var>.
  393.          *
  394.          * @param source the array to convert
  395.          * @param srcOffset the index where conversion begins
  396.          * @param numSigBytes the number of significant bytes in your array
  397.          * @param destination the array to hold the conversion
  398.          * @param destOffset the index where output will be put
  399.          * @return the <var>destination</var> array
  400.          * @since 1.3
  401.          */
  402.         private static byte[] encode3to4(byte[] source, int srcOffset, int numSigBytes,
  403.                 byte[] destination, int destOffset )
  404.         {
  405.             //           1         2         3
  406.             // 01234567890123456789012345678901 Bit position
  407.             // --------000000001111111122222222 Array position from threeBytes
  408.             // --------|    ||    ||    ||    | Six bit groups to index ALPHABET
  409.             //          >>18  >>12  >> 6  >> 0  Right shift necessary
  410.             //                0x3f  0x3f  0x3f  Additional AND
  411.  
  412.             // Create buffer with zero-padding if there are only one or two
  413.             // significant bytes passed in the array.
  414.             // We have to shift left 24 in order to flush out the 1's that appear
  415.             // when Java treats a value as negative that is cast from a byte to an int.
  416.             final int inBuff =   ( numSigBytes > 0 ? ((source[ srcOffset     ] << 24) >>>  8) : 0 )
  417.                          | ( numSigBytes > 1 ? ((source[ srcOffset + 1 ] << 24) >>> 16) : 0 )
  418.                          | ( numSigBytes > 2 ? ((source[ srcOffset + 2 ] << 24) >>> 24) : 0 );
  419.  
  420.             switch( numSigBytes )
  421.             {
  422.                 case 3:
  423.                     destination[ destOffset     ] = ALPHABET[ (inBuff >>> 18)        ];
  424.                     destination[ destOffset + 1 ] = ALPHABET[ (inBuff >>> 12) & 0x3f ];
  425.                     destination[ destOffset + 2 ] = ALPHABET[ (inBuff >>>  6) & 0x3f ];
  426.                     destination[ destOffset + 3 ] = ALPHABET[ (inBuff       ) & 0x3f ];
  427.                     return destination;
  428.  
  429.                 case 2:
  430.                     destination[ destOffset     ] = ALPHABET[ (inBuff >>> 18)        ];
  431.                     destination[ destOffset + 1 ] = ALPHABET[ (inBuff >>> 12) & 0x3f ];
  432.                     destination[ destOffset + 2 ] = ALPHABET[ (inBuff >>>  6) & 0x3f ];
  433.                     destination[ destOffset + 3 ] = EQUALS_SIGN;
  434.                     return destination;
  435.  
  436.                 case 1:
  437.                     destination[ destOffset     ] = ALPHABET[ (inBuff >>> 18)        ];
  438.                     destination[ destOffset + 1 ] = ALPHABET[ (inBuff >>> 12) & 0x3f ];
  439.                     destination[ destOffset + 2 ] = EQUALS_SIGN;
  440.                     destination[ destOffset + 3 ] = EQUALS_SIGN;
  441.                     return destination;
  442.  
  443.                 default:
  444.                     return destination;
  445.             }   // end switch
  446.         }   // end encode3to4
  447.  
  448.  
  449.         /**
  450.          * Encodes a byte array into Base64 notation.
  451.          * Does not GZip-compress data.
  452.          *
  453.          * @param source The data to convert
  454.          * @return the encoded byte array
  455.          * @since 1.4
  456.          */
  457.         public static String encodeBytes( byte[] source ) {
  458.             return encodeBytes( source, 0, source.length, NO_OPTIONS );
  459.         }   // end encodeBytes
  460.  
  461.         /**
  462.          *    Encodes a byte array into Base64 notation.
  463.          *
  464.          *    @param source
  465.          *        data to be encoded.
  466.          *    @param off
  467.          *        offset into source of first byte to be encoded.
  468.          *    @param len
  469.          *        number of bytes to encode.
  470.          *    @param options
  471.          *        encoding options (see {@link Base64}).
  472.          *  @return the encoded String
  473.          *
  474.          *    @since 2.0
  475.          */
  476.         public static String encodeBytes( byte[] source, int off, int len, int options ) {
  477.             // Isolate options
  478.             final int dontBreakLines = ( options & DONT_BREAK_LINES );
  479.  
  480.              // Convert option to boolean in way that code likes it.
  481.             final boolean breakLines = dontBreakLines == 0;
  482.  
  483.             final int    len43   = len * 4 / 3;
  484.             final byte[] outBuff = new byte[   ( len43 )                      // Main 4:3
  485.                                        + ( (len % 3) > 0 ? 4 : 0 )      // Account for padding
  486.                                        + (breakLines ? ( len43 / MAX_LINE_LENGTH ) : 0) ]; // New lines
  487.             int d = 0;
  488.             int e = 0;
  489.             final int len2 = len - 2;
  490.             int lineLength = 0;
  491.             for( ; d < len2; d+=3, e+=4 ) {
  492.                 encode3to4( source, d+off, 3, outBuff, e );
  493.  
  494.                 lineLength += 4;
  495.                 if( breakLines && lineLength == MAX_LINE_LENGTH ) {
  496.                     outBuff[e+4] = NEW_LINE;
  497.                     e++;
  498.                     lineLength = 0;
  499.                 }   // end if: end of line
  500.             }   // en dfor: each piece of array
  501.  
  502.             if( d < len ) {
  503.                 encode3to4( source, d+off, len - d, outBuff, e );
  504.                 e += 4;
  505.             }   // end if: some padding needed
  506.  
  507.  
  508.             // Return value according to relevant encoding.
  509.             try {
  510.                 return new String( outBuff, 0, e, PREFERRED_ENCODING );
  511.             } catch (UnsupportedEncodingException uue) {
  512.                 return new String( outBuff, 0, e );
  513.             }   // end catch
  514.         }   // end encodeBytes
  515.     }   // end class Base64
  516. }
Oct 1 '08 #3
bw171
5 New Member
You must've left out something crucial here because that enum is definitely not
defined on line #37 and everything is syntactically fine in the code snippet you've
shown us. Something else (invisible to us) before that line is missing a semi
colon.

kind regards,

Jos
Also, would knowing the version help

java version "1.4.2_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
Java HotSpot(TM) Client VM (build 1.4.2_04-b05, mixed mode)
Oct 1 '08 #4
JosAH
11,448 Recognized Expert MVP
(I just got back home) Yup, that's it: before version 1.5 Java didn't know about
enums; that's where the errors came from. Either don't use enums or upgrade
to at least version 1.5. btw. version 1.4 is ending it's EOL cycle anyway.

kind regards,

Jos
Oct 1 '08 #5
bw171
5 New Member
(I just got back home) Yup, that's it: before version 1.5 Java didn't know about
enums; that's where the errors came from. Either don't use enums or upgrade
to at least version 1.5. btw. version 1.4 is ending it's EOL cycle anyway.

kind regards,

Jos
Well that could be an entirely different post.....
Being a newbie, I am not sure how I would re code that to achieve what I want
Basically, i want to set the output of the report either as a CSV file or a TXT file.
Oct 1 '08 #6
JosAH
11,448 Recognized Expert MVP
Well that could be an entirely different post.....
Being a newbie, I am not sure how I would re code that to achieve what I want
Basically, i want to set the output of the report either as a CSV file or a TXT file.
Just define a few final members of a reasonable type:

Expand|Select|Wrap|Line Numbers
  1. private static final String TXT= "TXT";
  2. private static final String CSV= "CSV";
  3.  
... and use those instead of the enum class.

kind regards,

Jos
Oct 2 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

20
4850
by: Glenn Venzke | last post by:
I'm writing a class with a method that will accept 1 of 3 items listed in an enum. Is it possible to pass the item name without the enum name in your calling statement? EXAMPLE: public enum EnumName FirstValue = 1 SecondValue = 2 ThirdValue = 3
18
11368
by: Visual Systems AB \(Martin Arvidsson\) | last post by:
Hi! I have created an enum list like this: enum myEnum : int { This = 2, That, NewVal = 10, LastItm
21
2172
by: dllhell | last post by:
hi all, I have a problem with creating proc with a enum as a param. I wish to pass an enumeration in proc in which one I intend to do some operations with enumeration, but I don't know which one enumeration I'll pass. so... I have tried with: string SomeResult (enum** _enum) { }
2
12625
by: snowie | last post by:
I have a simillar problem to what others have had before me. I just can't find the solution in any earlier post here at the scripts (or any other forum). I am calling a web service that returns a string, the string is an object serialized into XML. The XML returned could look like: ...
34
11203
by: Steven Nagy | last post by:
So I was needing some extra power from my enums and implemented the typesafe enum pattern. And it got me to thinking... why should I EVER use standard enums? There's now a nice little code snippet that I wrote today that gives me an instant implementation of the pattern. I could easily just always use such an implementation instead of a standard enum, so I wanted to know what you experts all thought. Is there a case for standard enums?
2
16268
by: audiokarate | last post by:
I have like atleast 15 errors that say class, interface, or enum expected and I have no idea what that means. Can someone tell me what it is and how I might be able to fix it? Thank you. - Manny *Program Purpose: This program processes the results for the 2008 Democratic and/or Republican presidential primary elections.
15
3341
by: judge82 | last post by:
I made sure I closed all the bracket, why do i still get the error. on line 360, 424, 425 and 607 Please help /* * ShopCartServletHW3.java *
8
8563
by: benn | last post by:
Here's the setup... Defines.h file contains: enum DAY { monday, tueday }; DayFunctions.h contains prototype: void printIsMonday ( enum DAY currentDay); DayFunctions.c contains:
1
2283
by: chanshaw | last post by:
Hey I'm trying to execute a simple statement but im getting a java.sql.Statement is abstract; cannot be instantiated. I just want to execute a simple select statement import java.sql.Statement; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.sql.Connection; import java.sql.DriverManager;
0
9591
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9425
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10053
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10001
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9867
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6676
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5312
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3969
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3573
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.