how to append string to the file at the starting location in a file
I have file as below.

      rule "IC-86"
    	agenda-group "commonATSP"
    	dialect "mvel"
    	when
    		eval($count > 10)
    	then
    		modify( $attribute ){ $imageVersion,$attributes.get(),imageName };
    end


I need to append the below mentioned string at the top of the file.

    import java.lang.Exception;

The output should looks like as below.

      import java.lang.Exception;
      rule "IC-86"
        	agenda-group "commonATSP"
        	dialect "mvel"
        	when
        		eval($count > 10)
        	then
        		modify( $attribute ){ $imageVersion,$attributes.get(),imageName };
        end

Please provide me some pointers to implement the same using java.
how to append string to the file at the starting location in a file
===

I have file as below.

      rule "IC-86"
    	agenda-group "commonATSP"
    	dialect "mvel"
    	when
    		eval($count > 10)
    	then
    		modify( $attribute ){ $imageVersion,$attributes.get(),imageName };
    end


I need to append the below mentioned string at the top of the file.

    import java.lang.Exception;

The output should looks like as below.

      import java.lang.Exception;
      rule "IC-86"
        	agenda-group "commonATSP"
        	dialect "mvel"
        	when
        		eval($count > 10)
        	then
        		modify( $attribute ){ $imageVersion,$attributes.get(),imageName };
        end

Please provide me some pointers to implement the same using java.