Java: Ficheros en un Applet

Cuestiones y dudas acerca de lenguajes de programación diversos.

Moderador: Moderadores

Programador
Novat@
Mensajes: 3
Registrado: Jue Feb 16, 2006 11:33 am

Java: Ficheros en un Applet

Mensaje por Programador » Mar Feb 28, 2006 7:08 am

Hola, es posible utilizar ficheros en un Applet?
Esque bajé un código de ficheros en Java pero no me funciona en el Applet, aquí está el código:

Código: Seleccionar todo

 File miFichero;
    miFichero = new File( "/etc/kk" );

    miFichero = new File( "/etc","kk" );

    File miDirectorio = new File( "/etc" );
    miFichero = new File( miDirectorio,"kk" );

import java.io.*;

class InfoFichero {

    public static void main( String args[] ) throws IOException {
        if( args.length > 0 )
            {
            for( int i=0; i < args.length; i++ )
                {
                File f = new File( args[i] );
                System.out.println( "Nombre: "+f.getName() );
                System.out.println( "Camino: "+f.getPath() );
                if( f.exists() )
                    {
                    System.out.print( "Fichero existente " );
                    System.out.print( (f.canRead() ? 
                        " y se puede Leer" : "" ) );
                    System.out.print( (f.canWrite() ? 
                        " y se puese Escribir" : "" ) );
                    System.out.println( "." );
                    System.out.println( "La longitud del fichero son "+
                        f.length()+" bytes" );
                    }
                else
                    System.out.println( "El fichero no existe." );
                }
            }
        else
            System.out.println( "Debe indicar un fichero." );
        }
    }

Cualquier ayuda se los agradecería, ya que no se puede decir que soy un experto en Java.[/quote]