~ubuntu-branches/ubuntu/gutsy/jflex/gutsy

« back to all changes in this revision

Viewing changes to examples/binary/README

  • Committer: Bazaar Package Importer
  • Author(s): Takashi Okamoto
  • Date: 2002-02-16 13:38:21 UTC
  • Revision ID: james.westby@ubuntu.com-20020216133821-5wsdprpt9xl7ondr
Tags: upstream-1.3.5
ImportĀ upstreamĀ versionĀ 1.3.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
This directory contains a small example of a scanner for binary files.
 
2
 
 
3
The example tries to detect if an input file is a java class file by
 
4
checking if the first 4 bytes contain the magic number 0xCAFEBABE.
 
5
It uses a custom Reader class that copies bytes to characters one to
 
6
one. The characters the scanner gets to read are the bytes from the
 
7
input stream without any conversion. Many thanks to Stephen Ostermiller
 
8
for providing the custom Reader class, the original version of that
 
9
class is available from http://www.smo.f2s.com/utils/
 
10
 
 
11
See the JFlex manual for details on how to scan binaries and how
 
12
this is different from scanning text files.
 
13
 
 
14
Files:
 
15
binary.flex                 the scanner spec
 
16
StraightStreamReader.java   the custom reader class (by Stephen Ostermiller)
 
17
Makefile                    rules for make to compile and run the example
 
18
README                      this file