AnnotatedOutput.java revision 128e8279c3cf44cc1d1c8f263035ba8e4044d5c6
1/*
2 * Copyright (C) 2007 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/*
18 * As per the Apache license requirements, this file has been modified
19 * from its original state.
20 *
21 * Such modifications are Copyright (C) 2010 Ben Gruver, and are released
22 * under the original license
23 */
24
25package org.jf.dexlib.Util;
26
27/**
28 * Interface for a binary output destination that may be augmented
29 * with textual annotations.
30 */
31public interface AnnotatedOutput
32        extends Output {
33    /**
34     * Get whether this instance will actually keep annotations.
35     *
36     * @return <code>true</code> iff annotations are being kept
37     */
38    public boolean annotates();
39
40    /**
41     * Get whether this instance is intended to keep verbose annotations.
42     * Annotators may use the result of calling this method to inform their
43     * annotation activity.
44     *
45     * @return <code>true</code> iff annotations are to be verbose
46     */
47    public boolean isVerbose();
48
49    /**
50     * Add an annotation for the subsequent output. Any previously
51     * open annotation will be closed by this call, and the new
52     * annotation marks all subsequent output until another annotation
53     * call.
54     *
55     * @param msg non-null; the annotation message
56     */
57    public void annotate(String msg);
58
59    /**
60     * Add an annotation for a specified amount of subsequent
61     * output. Any previously open annotation will be closed by this
62     * call. If there is already pending annotation from one or more
63     * previous calls to this method, the new call "consumes" output
64     * after all the output covered by the previous calls.
65     *
66     * @param amt &gt;= 0; the amount of output for this annotation to
67     * cover
68     * @param msg non-null; the annotation message
69     */
70    public void annotate(int amt, String msg);
71
72    /**
73     * End the most recent annotation. Subsequent output will be unannotated,
74     * until the next call to {@link #annotate}.
75     */
76    public void endAnnotation();
77
78    /**
79     * Get the maximum width of the annotated output. This is advisory:
80     * Implementations of this interface are encouraged to deal with too-wide
81     * output, but annotaters are encouraged to attempt to avoid exceeding
82     * the indicated width.
83     *
84     * @return &gt;= 1; the maximum width
85     */
86    public int getAnnotationWidth();
87
88    public void setIndentAmount(int indentAmount);
89    public void indent();
90    public void deindent();
91}