A method and an apparatus for encoding and decoding a modulation code are
provided. The method includes: adding an error detection bit(s) to source
information; performing k-constraint coding by inserting an error pattern
that can be detected using an error detection code into a data stream
that violates a k-constraint for a run length limited (RLL) code in a
data stream comprising the error detection bit(s) and the source
information, and recording the data stream after being k-constraint coded
onto a recording medium; and reading the data stream recorded onto the
recording medium and determining whether an error is present in the data
stream.