There is no reason why you can't, in theory, open a file for writing
inside of an aspect.  You would use the same technique as you would
inside of Java.  However, the code you have below is incorrect for
several reasons.  You would need to do something like this inside of
an Aspect:

        try {
            FileOutputStream f=new FileOutputStream("/tmp/test.txt");
            f.write("text".getBytes());
        } catch (Exception e) {
            e.printStackTrace();
        }


On Fri, Oct 28, 2011 at 8:50 AM, Shambhavi Joshi <[email protected]> wrote:
> can files be used in aspectj?
> im trying to store the output of a program in a file using the following
> colde:
> public aspect Test
> {
> FileOutputStream f=new FileOutputStream("test.txt");
> before(): //some code
> {
>     fo.write("text");
> }
> after():
> {
> }
> }
> the above code gives me error.can a file objec be created in an aspect?
> i would be glad to get this problem solved as early as possible.
> --
> Shambhavi Joshi
>
> _______________________________________________
> aspectj-users mailing list
> [email protected]
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>
_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to