• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

wuwen5 / hessian / 17132572548

21 Aug 2025 04:02PM UTC coverage: 56.631% (+12.0%) from 44.593%
17132572548

push

github

web-flow
refactor: remove startData1\State1,move readArguments to HessianRpcInput (#26)

1519 of 2847 branches covered (53.35%)

Branch coverage included in aggregate %.

3494 of 6005 relevant lines covered (58.18%)

2.56 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

72.97
hessian2-codec/src/main/java/io/github/wuwen5/hessian/io/HessianDebugInputStream.java
1
/*
2
 * Copyright (c) 2001-2008 Caucho Technology, Inc.  All rights reserved.
3
 *
4
 * The Apache Software License, Version 1.1
5
 *
6
 * Redistribution and use in source and binary forms, with or without
7
 * modification, are permitted provided that the following conditions
8
 * are met:
9
 *
10
 * 1. Redistributions of source code must retain the above copyright
11
 *    notice, this list of conditions and the following disclaimer.
12
 *
13
 * 2. Redistributions in binary form must reproduce the above copyright
14
 *    notice, this list of conditions and the following disclaimer in
15
 *    the documentation and/or other materials provided with the
16
 *    distribution.
17
 *
18
 * 3. The end-user documentation included with the redistribution, if
19
 *    any, must include the following acknowlegement:
20
 *       "This product includes software developed by the
21
 *        Caucho Technology (http://www.caucho.com/)."
22
 *    Alternately, this acknowlegement may appear in the software itself,
23
 *    if and wherever such third-party acknowlegements normally appear.
24
 *
25
 * 4. The names "Hessian", "Resin", and "Caucho" must not be used to
26
 *    endorse or promote products derived from this software without prior
27
 *    written permission. For written permission, please contact
28
 *    info@caucho.com.
29
 *
30
 * 5. Products derived from this software may not be called "Resin"
31
 *    nor may "Resin" appear in their names without prior written
32
 *    permission of Caucho Technology.
33
 *
34
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
35
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
36
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
37
 * DISCLAIMED.  IN NO EVENT SHALL CAUCHO TECHNOLOGY OR ITS CONTRIBUTORS
38
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
39
 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
40
 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
41
 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
42
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
43
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
44
 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
45
 *
46
 * @author Scott Ferguson
47
 */
48

49
package io.github.wuwen5.hessian.io;
50

51
import io.github.wuwen5.hessian.LineFlushingWriter;
52
import java.io.IOException;
53
import java.io.InputStream;
54
import java.io.OutputStream;
55
import java.io.PrintWriter;
56
import java.util.function.Consumer;
57

58
/**
59
 * Debugging input stream for Hessian requests.
60
 */
61
public class HessianDebugInputStream extends InputStream {
62
    private InputStream is;
63

64
    private final HessianDebugState state;
65

66
    /**
67
     * Creates an uninitialized Hessian input stream.
68
     */
69
    public HessianDebugInputStream(InputStream is, OutputStream os) {
70
        this(is, new PrintWriter(os));
×
71
    }
×
72

73
    /**
74
     * Creates an uninitialized Hessian input stream.
75
     */
76
    public HessianDebugInputStream(InputStream is, PrintWriter dbg) {
2✔
77
        this.is = is;
3✔
78

79
        if (dbg == null) {
2!
80
            dbg = new PrintWriter(System.out);
×
81
        }
82

83
        state = new HessianDebugState(dbg);
6✔
84
    }
1✔
85

86
    /**
87
     * Creates an uninitialized Hessian input stream.
88
     */
89
    public HessianDebugInputStream(InputStream is, Consumer<String> logger) {
90
        this(is, new PrintWriter(new LineFlushingWriter(logger)));
10✔
91
    }
1✔
92

93
    /**
94
     * Creates an uninitialized Hessian input stream.
95
     */
96
    public HessianDebugInputStream(Consumer<String> logger) {
97
        this(null, logger);
4✔
98
    }
1✔
99

100
    public void initPacket(InputStream is) {
101
        this.is = is;
3✔
102
    }
1✔
103

104
    public void startTop2() {
105
        state.startTop2();
3✔
106
    }
1✔
107

108
    public void startStreaming() {
109
        state.startStreaming();
×
110
    }
×
111

112
    public void setDepth(int depth) {
113
        state.setDepth(depth);
×
114
    }
×
115

116
    /**
117
     * Reads a character.
118
     */
119
    @Override
120
    public int read() throws IOException {
121
        int ch;
122

123
        if (this.is == null) {
3!
124
            return -1;
×
125
        } else {
126
            ch = this.is.read();
4✔
127
        }
128

129
        state.next(ch);
4✔
130

131
        return ch;
2✔
132
    }
133

134
    /**
135
     * closes the stream.
136
     */
137
    @Override
138
    public void close() throws IOException {
139
        InputStream lis = this.is;
3✔
140
        this.is = null;
3✔
141

142
        if (lis != null) {
2✔
143
            lis.close();
2✔
144
        }
145

146
        state.println();
3✔
147
    }
1✔
148
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc