| WriteFile.java

WriteFile.java

    /*
     * WriteFile.java    1.0 97/11/06
     *
     * Copyright (c) 1997 Netscape Communications Corporation
     *
     * Netscape grants you a non-exclusive, royalty free, license to use,
     * modify and redistribute this software in source and binary code form,
     * provided that i) this copyright notice and license appear on all copies of
     * the software; and ii) Licensee does not utilize the software in a manner
     * which is disparaging to Netscape.
     *
     * This software is provided "AS IS," without a warranty of any kind.
     * See the CDK License Agreement for additional terms and conditions.
     * -garys
     */
    package netscape.samples.jsbdoc;

    import java.io.*;

    public class WriteFile {
        public WriteFile(String fileName, String str) {
            try {
                DataOutputStream dos = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(fileName),512));
                dos.writeBytes(str);
                dos.flush();
            } catch (IOException ioe) {
                System.out.println("class WriteFile caught i/o exception" + ioe);
            }
        }
        public static void main(String args[]) {
            try {
                new WriteFile(args[0], args[1]);
            } catch (Exception e) {
                System.out.println("usage: java WriteFile [filename] [string]");
            }
        }
    }