// randaccess.java //
// An example file explaining how to use // com.stevesoft.pat, com.stevesoft.pat.wrap, // and com.stevesoft.pat.apps //
// This software comes without express or implied warranty. // No claim is made about the suitability of this software for // any purpose and neither we nor SteveSoft shall be liable for // damages suffered by the user of this software. import com.stevesoft.pat.wrap.*; import com.stevesoft.pat.*; import java.io.*; // An example demonstrating how to search a random access // file with Regex. public class randaccess { public static void main(String[] args) throws Exception { RandomAccessFile raf = new RandomAccessFile("randaccess.java","r"); Regex findFoo = new Regex("foo"); findFoo.search(new RandomAccessFileWrap(raf)); System.out.println( "Foo found at index: "+findFoo.matchedFrom()); } }