For ARM-blocks you can have a look at the @Cleanup annotation of
Lombok and have ARM-blocks for Java right now!
The following code will close both streams correctly after they run
out of scope.
import lombok.Cleanup;
import java.io.*;
public class CleanupExample {
public static void main(String[] args) throws IOException {
@Cleanup InputStream in = new FileInputStream(args[0]);
@Cleanup OutputStream out = new FileOutputStream(args[1]);
byte[] b = new byte[10000];
while (true) {
int r = in.read(b);
if (r == -1) break;
out.write(b, 0, r);
}
}
}
See http://projectlombok.org/features/Cleanup.html for more
information
On Sep 1, 2:19 pm, "joel.neely" <[email protected]> wrote:
> According to coverage
> athttp://arstechnica.com/apple/reviews/2009/08/mac-os-x-10-6.ars/10
> , Snow Leopard, the latest version of Mac OS X, added "blocks" to C.
> The article illustrates this new language construct with the by-now
> canonical ARM and home-grown-control-structure examples.
>
> Hey, Java! Closures to the left of me [JRuby, Scala, etc.], blocks to
> the right [C on OS X], here I am, stuck in the middle with you!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "The
Java Posse" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/javaposse?hl=en
-~----------~----~----~----~------~----~------~--~---