Search Java Code Snippets


  Help us in improving the repository. Add new snippets through 'Submit Code Snippet ' link.





#Java - Code Snippets for '#Java.io.FileOutputStream' - 2 code snippet(s) found

 Sample 1. Code Sample / Example / Snippet of java.io.FileOutputStream

    public static void copy(File input, File output) throws IOException {

FileInputStream fis = new FileInputStream(input);

FileOutputStream fos = new FileOutputStream(output);



try {

FileChannel ic = fis.getChannel();

FileChannel oc = fos.getChannel();

try {

oc.transferFrom(ic, 0, ic.size());

}

finally {

oc.close();

ic.close();

}

}

finally {

fis.close();

fos.close();

}

}


   Like      Feedback      java.io.FileOutputStream


 Sample 2. Code Sample / Example / Snippet of javax.naming.CompositeName

    public static void main(String[] args) throws Exception {

CompositeName c = new CompositeName("aaa/bbb");

java.io.FileOutputStream f1 = new java.io.FileOutputStream("/tmp/ser");

java.io.ObjectOutputStream s1 = new java.io.ObjectOutputStream(f1);

s1.writeObject(c);

s1.close();

java.io.FileInputStream f2 = new java.io.FileInputStream("/tmp/ser");

java.io.ObjectInputStream s2 = new java.io.ObjectInputStream(f2);

c = (CompositeName)s2.readObject();



System.out.println("Size: " + c.size());

System.out.println("Size: " + c.snit);

}


   Like      Feedback      javax.naming.CompositeName



Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner