类 RunLength
- java.lang.Object
-
- edu.princeton.cs.algs4.RunLength
-
public class RunLength extends java.lang.Object
TheRunLength
class provides static methods for compressing and expanding a binary input using run-length coding with 8-bit run lengths.For additional documentation, see Section 5.5 of Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne.
-
-
方法概要
修饰符和类型 方法 说明 static void
compress()
Reads a sequence of bits from standard input; compresses them using run-length coding with 8-bit run lengths; and writes the results to standard output.static void
expand()
Reads a sequence of bits from standard input (that are encoded using run-length encoding with 8-bit run lengths); decodes them; and writes the results to standard output.static void
main(java.lang.String[] args)
Sample client that callscompress()
if the command-line argument is "-" anexpand()
if it is "+".
-
-
-
方法详细资料
-
expand
public static void expand()
Reads a sequence of bits from standard input (that are encoded using run-length encoding with 8-bit run lengths); decodes them; and writes the results to standard output.
-
compress
public static void compress()
Reads a sequence of bits from standard input; compresses them using run-length coding with 8-bit run lengths; and writes the results to standard output.
-
main
public static void main(java.lang.String[] args)
Sample client that callscompress()
if the command-line argument is "-" anexpand()
if it is "+".- 参数:
args
- the command-line arguments
-
-