viernes, junio 09, 2006

Flujos en java

bueno en esta ocacion este codigo es muy simple tal vez y lo se, pero es para que mis amigos de la carrera se den una idea de como usar los flujos de datos en java, creamos nuevas carpetas en una direccion especifica, con carpetas intermedias, nuevos documentos que podemos abrir y modificar y guardar esos cambios, espero les ayude saludos a todo el 2 B de sistemas ITCancun y una disculpa por no poner algo mas complejo amigos soy principiante al igual que ustedes, solo cambien la dirreccion de carpetas por las que quieran suerte y estudien mucho que todos pasen.

good in this ocacion this code is very simple perhaps and, but it is so that my friends of the race occur an idea of like using the data flows in java, we created new folders in a direction specifies, with intermediate folders, new documents that we can open and modify and keep those changes, I wait for helps to all the 2 greetings them B of ITCancun systems and one excuses not to put something but complex friends I am nascent like you, single they change dirreccion of folders by which they want luck and they study much that all happen.

hey excuses friends is that English I do not promise myself to them to improve this code

import java.io.*;
class obj
{
public static void main(String args[])
{
FileOutputStream fos;
DataOutputStream cade;
File uno=new File("C:\\Documents and Settings\\julian ernesto\\Mis documentos\\Mi música\\julian3.txt");
if (uno.exists())


{
System.out.println("existe");
}
else
{
System.out.println("no existe");
}

System.out.println(uno.length());

if (uno.canRead())
System.out.println("leiendo ");
else
System.out.println("no se puede leer");

if (uno.canWrite())
System.out.println("como escribo ");
else
System.out.println("no se escribe");


System.out.println(uno.getName());
System.out.println(uno.lastModified());

if (uno.renameTo(new File ("C:\\Documents and Settings\\julian ernesto\\Mis documentos\\Mi música\\julian3.txt")))
System.out.println("ahora se llama julian3 ");
else
System.out.println("no se funciono");
File dos=new File("c:\\perro1");
if (dos.mkdir())
System.out.println("se creo perro");
else
System.out.println("fallo la creacion");
dos.renameTo(new File("c:\\perro1"));

File tres =new File("c:\\julio\\juli\\juli2\\juli3");
if (tres.mkdirs())
System.out.println("se creo");
else
System.out.println("fallo la creacion");

try{
fos = new FileOutputStream("c:\\Documents and Settings\\julian ernesto\\Mis documentos\\Mi música\\julian3.txt");

for (int n=0;n<100;n++)
{

fos.write(n);
}
fos.close();

}catch (Exception e){
e.toString();
System.out.println(e);
}

try{
fos = new FileOutputStream("c:\\Documents and Settings\\julian ernesto\\Mis documentos\\Mi música\\julian3.bat");

for (int n=0;n<100;n++)
{

fos.write(n);
}
fos.close();

}catch (Exception e){
e.toString();
System.out.println(e);
}

try{
fos = new FileOutputStream("c:\\Documents and Settings\\julian ernesto\\Mis documentos\\Mi música\\julianew.jpg");

for (int n=0;n<100;n++)
{

fos.write(n);
}
fos.close();

}catch (Exception e){
e.toString();
System.out.println(e);
}

try{
fos = new FileOutputStream("c:\\Documents and Settings\\julian ernesto\\Mis documentos\\Mi música\\juanes_para tu amor.mp3");

}catch (Exception e){
e.toString();
System.out.println(e);
}

try{
fos = new FileOutputStream("c:\\Documents and Settings\\julian ernesto\\Mis documentos\\Mi música\\julian7.txt");
cade = new DataOutputStream(fos);
cade.writeBytes("julian ernesto tun ku \n +"+"\n +esto crea el archivo julian7 y ecribe todo esto");
}catch (Exception e){
e.toString();
System.out.println(e);
}
}

}

y tambien les dejo unos links muy buenos
http://www.programacion.com/java/tutorial/joa_red/4/
http://www.programacion.com/java/tutorial/joa_red/2/
http://www.unalmed.edu.co/~daristiz/guias/ing_software/semana_8/flujos.pdf
http://www.geocities.com/CollegePark/Quad/8901/cap10.htm
http://www.people.virginia.edu/~am2zb/cursos/java/aplicaciones/ut_clases.htm
http://www.sc.ehu.es/sbweb/fisica/cursoJava/fundamentos/archivos/disco.htm
http://www.javahispano.org/code/snippets/Operaqciones_con_archivos.txt;jsessionid=58FB05CCCD06AE4AFB371EAC547D742E

No hay comentarios.:

Publicar un comentario

Deja tu comentario, te lo agradecere By Dzip