macca1979 0 Newbie Poster

Hey,

First off I'm really new to Java so please bear with me. I need to read in a file and translate it to a different output format. An example line segment from the input file has the following format:

"step(procs(),rule(1,A,B,vars(Na,Rv,ped(pk(B),cat(Na,A)))),procs())" (i)
This means that at step 1, A sends to B that which is contained in vars() i.e. Na, Rv and encryption of Na and A using B's public key [ped(pk(B),cat(Na,A))]

The output format I need is the following:

"K_B,t1(R(B,t1,(Na,Rv,e({Na,A},pk_B))))" (ii)

Basically this is generated from what is enclosed within rule() from (i) above. I have read up on how to use files and manipulate them and from what I've read I think i need to use string tokenisers to separate out the input format and thus build up the output form. However I really am at a loss as to how to begin coding this translation. If anyone has the time could they perhaps give me an example of some code that might solve this problem i.e. read in the file, translate the input to the form needed and then output the translated text to an output file. This is only a very small part of the overall translation that must be undertaken but seeing as I am so new to programming, if I could see how to get started the rest of the problem might not seem so daunting.

Thanks a million.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.