A data processing apparatus, comprising:
- a slide storage unit that sequentially stores input data input from a first terminal of the slide storage unit and sequentially slides stored data toward a second terminal of the slide storage unit upon each input;
- a first comparing unit that compares the input data input from the first terminal with each of the stored data in the slide storage unit in parallel and obtains a position of matching data of the stored data in the slide storage unit that matches the input data;
- a first determining unit that determines whether or not at least one of the stored data in the slide storage unit matches the input data compared by the first comparing unit based on a result of the comparison by the first comparing unit;
- a second comparing unit that compares the input data input from the first terminal with each of the stored data in the slide storage unit in parallel and obtains a position of matching data of the stored data in the slide storage unit that matches the input data;
- a second determining unit that determines whether or not at least one of the stored data in the slide storage unit matches the input data compared by the second comparing unit based on a result of the comparison by the second comparing unit;
- a holding unit that holds the result of the comparison by the first or second comparing unit based on results of the determinations by the first and the second determining units;
- an address value generating unit that generates an address value representing the position of the matching data based on the result of the comparison by the first or second comparing unit that is held by the holding unit according to the result of the determination by the second determining unit;
- a length value generating unit that obtains a longest length of a matching data list of the store data in the slide storage unit that match the input data compared by the second comparing unit and that is at positions in the slide storage unit consecutive over each input of the input data to the slide storage unit, and generates a length value representing the longest length, according to the result of the determination by the second determining unit;
- a data value generating unit that generates a data value that uses the input data as is according to the results of the determinations by the first and second determining units;
- and
- a code generating unit that generates a code including the address value, the length value, and the data value,
- wherein the comparison by the second comparing unit of comparing each of the stored data in the slide storage unit with the input data input from the first terminal is controlled based on the result of the comparison by the first or second comparing unit held in the holding unit.