// Decompiled by DJ v2.6.6.51 Copyright 2000 Atanas Neshkov  Date: 6/15/2001 17:43:12
// Home Page : http://members.fortunecity.com/neshkov/dj.html  - Check often for new version!
// Decompiler options: packimports(3) 
// Source File Name:   com/macromedia/generator/app/FileDataSource

package com.macromedia.generator.app;

import com.macromedia.generator.platform.Mac;
import java.io.*;

// Referenced classes of package com.macromedia.generator.app:
//            StreamDataSource, FlashEnvironment

public class FileDataSource extends StreamDataSource
{

    public FileDataSource()
    {
    }

    public String[][] getData(String s)
    {
        String as[][] = null;
        try
        {
            FileInputStream fileinputstream = new FileInputStream(s);
            Mac mac = Mac.getMac();
            if(mac != null)
            {
                String s1 = mac.makeJavaPretty(s);
                as = super.getData(fileinputstream, s1);
            } else
            {
                as = super.getData(fileinputstream, s);
            }
            fileinputstream.close();
        }
        catch(FileNotFoundException _ex)
        {
            env.logMessage("com.macromedia.generator.resources.DataSourceData", "InvalidFile", s);
            as = null;
        }
        catch(IOException _ex)
        {
            env.logMessage("com.macromedia.generator.resources.DataSourceData", "IOException", s);
            as = null;
        }
        if(as != null && env != null && env.logLevel() > 2)
        {
            env.logMessage("com.macromedia.generator.resources.DataSourceData", "DumpData", s);
            int i = as.length;
            StringBuffer stringbuffer = new StringBuffer(128);
            for(int j = 0; j < i; j++)
            {
                stringbuffer.setLength(0);
                stringbuffer.append(j + 1);
                stringbuffer.append(": ");
                int k = as[j].length;
                for(int l = 0; l < k; l++)
                {
                    if(l > 0)
                        stringbuffer.append(", ");
                    stringbuffer.append(as[j][l]);
                }

                env.logMessage("com.macromedia.generator.resources.DataSourceData", "DumpRow", stringbuffer.toString());
            }

        }
        return as;
    }

    public static void main(String args[])
    {
        FileDataSource filedatasource = new FileDataSource();
        String args1[][] = filedatasource.getData(args[0]);
        int i = args1.length;
        int j = args1[0].length;
        for(int k = 0; k < i; k++)
        {
            for(int l = 0; l < j; l++)
                System.out.print(args1[k][l] + ",");

            System.out.println("");
        }

    }
}