Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

…lines 1–135 unchanged (135 lines)
136
137 /**
138 * {@inheritDoc}
139 *
140 * @throws IllegalArgumentException if the provided skip length is negative
141 */
142
143 // skip in chunks of 512 bytes
144
145
146 /**
147 * {@inheritDoc}
148 *
149 * @return <code>0</code> if the {@link InputStream} has reached <code>EOF</code>,
150 * <code>1</code> otherwise
151 */
152 // Note: the logic is similar to the InflaterInputStream:
153 // as long as we have not reached EOF, indicate that there is more
154 // data available. As we do not know for sure how much data is left,
155 // just return 1 as a safe guess.
156
157 // use the EOF flag of the underlying codec instance
158}
159

After

…lines 1–135 unchanged (135 lines)
136
137 /**
138 * {@inheritDoc}
139 *
140 * @throws IllegalArgumentException if the provided skip length is negative
141 */
142 @Override
143 public long skip(long n) throws IOException {
144 if (n < 0) {
145 throw new IllegalArgumentException("Negative skip length");
146 }
147
148 // skip in chunks of 512 bytes
149 final byte[] b = new byte[512];
150 final int max = (int) Math.min(n, Integer.MAX_VALUE);
151 int total = 0;
152
153 while (total < max) {
154 int len = max - total;
155 if (len > b.length) {
156 len = b.length;
157 }
158 len = read(b, 0, len);
159 if (len == EOF) {
160 break;
161 }
162 total += len;
163 }
164
165 return total;
166 }
167
168 /**
169 * {@inheritDoc}
170 *
171 * @return <code>0</code> if the {@link InputStream} has reached <code>EOF</code>,
172 * <code>1</code> otherwise
173 */
174 public int available() throws IOException {
175 // Note: the logic is similar to the InflaterInputStream:
176 // as long as we have not reached EOF, indicate that there is more
177 // data available. As we do not know for sure how much data is left,
178 // just return 1 as a safe guess.
179
180 // use the EOF flag of the underlying codec instance
181 if (baseNCodec.eof) {
182 return 0;
183 } else {
184 return 1;
185 }
186 }
187}
188

Before

program
block_comment "/*\n * Licensed to the Apache Software Foundation (ASF) under"...
package_declaration
package "package"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "codec"
. "."
identifier "binary"
; ";"
import_declaration (+23 nodes collapsed)
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "FilterInputStream"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "IOException"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "InputStream"
; ";"
block_comment "/**\n * Abstract superclass for Base-N input streams.\n * \n * "...
class_declaration
modifiers
public "public"
class "class"
identifier "BaseNCodecInputStream"
superclass
extends "extends"
type_identifier "FilterInputStream"
class_body
{ "{"
field_declaration
modifiers
private "private"
final "final"
boolean_type "boolean"
variable_declarator
identifier "doEncode"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "BaseNCodec"
variable_declarator
identifier "baseNCodec"
; ";"
field_declaration (+22 nodes collapsed)
constructor_declaration (+46 nodes collapsed)
block_comment "/**\n * Reads one <code>byte</code> from this input strea"...
method_declaration (+107 nodes collapsed)
block_comment "/**\n * Attempts to read <code>len</code> bytes into the "...
method_declaration (+281 nodes collapsed)
block_comment "/**\n * {@inheritDoc}\n * \n * @return false\n *"...
method_declaration
modifiers
marker_annotation
@ "@"
identifier "Override"
public "public"
boolean_type "boolean"
identifier "markSupported"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
false "false"
; ";"
line_comment "// not an easy job to support marks"
} "}"
block_comment "/**\n * {@inheritDoc}\n *\n * @throws IllegalArgume"...
line_comment "// skip in chunks of 512 bytes"
block_comment "/**\n * {@inheritDoc}\n *\n * @return <code>0</code"...
line_comment "// Note: the logic is similar to the InflaterInputStream:"
line_comment "// as long as we have not reached EOF, indicate that t"...
line_comment "// data available. As we do not know for sure how much"...
line_comment "// just return 1 as a safe guess."
line_comment "// use the EOF flag of the underlying codec instance"
} "}"

After

program
block_comment "/*\n * Licensed to the Apache Software Foundation (ASF) under"...
package_declaration
package "package"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "codec"
. "."
identifier "binary"
; ";"
import_declaration (+23 nodes collapsed)
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "FilterInputStream"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "IOException"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "InputStream"
; ";"
block_comment "/**\n * Abstract superclass for Base-N input streams.\n * \n * "...
class_declaration
modifiers
public "public"
class "class"
identifier "BaseNCodecInputStream"
superclass
extends "extends"
type_identifier "FilterInputStream"
class_body
{ "{"
field_declaration
modifiers
private "private"
final "final"
boolean_type "boolean"
variable_declarator
identifier "doEncode"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "BaseNCodec"
variable_declarator
identifier "baseNCodec"
; ";"
field_declaration (+22 nodes collapsed)
constructor_declaration (+46 nodes collapsed)
block_comment "/**\n * Reads one <code>byte</code> from this input strea"...
method_declaration (+107 nodes collapsed)
block_comment "/**\n * Attempts to read <code>len</code> bytes into the "...
method_declaration (+281 nodes collapsed)
block_comment "/**\n * {@inheritDoc}\n * \n * @return false\n *"...
method_declaration
modifiers
marker_annotation
@ "@"
identifier "Override"
public "public"
boolean_type "boolean"
identifier "markSupported"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
false "false"
; ";"
line_comment "// not an easy job to support marks"
} "}"
block_comment "/**\n * {@inheritDoc}\n *\n * @throws IllegalArgume"...
method_declaration
modifiers
marker_annotation
@ "@"
identifier "Override"
public "public"
integral_type
long "long"
identifier "skip"
formal_parameters
( "("
formal_parameter
integral_type
long "long"
identifier "n"
) ")"
throws
throws "throws"
type_identifier "IOException"
block
{ "{"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "n"
< "<"
decimal_integer_literal "0"
) ")"
block
{ "{"
throw_statement
throw "throw"
object_creation_expression
new "new"
type_identifier "IllegalArgumentException"
argument_list
( "("
string_literal
" "\""
string_fragment "Negative skip length"
" "\""
) ")"
; ";"
} "}"
line_comment "// skip in chunks of 512 bytes"
local_variable_declaration
modifiers
final "final"
array_type
integral_type
byte "byte"
dimensions
[ "["
] "]"
variable_declarator
identifier "b"
= "="
array_creation_expression
new "new"
integral_type
byte "byte"
dimensions_expr
[ "["
decimal_integer_literal "512"
] "]"
; ";"
local_variable_declaration
modifiers
final "final"
integral_type
int "int"
variable_declarator
identifier "max"
= "="
cast_expression
( "("
integral_type
int "int"
) ")"
method_invocation
identifier "Math"
. "."
identifier "min"
argument_list
( "("
identifier "n"
, ","
field_access
identifier "Integer"
. "."
identifier "MAX_VALUE"
) ")"
; ";"
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "total"
= "="
decimal_integer_literal "0"
; ";"
while_statement
while "while"
parenthesized_expression
( "("
binary_expression
identifier "total"
< "<"
identifier "max"
) ")"
block
{ "{"
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "len"
= "="
binary_expression
identifier "max"
- "-"
identifier "total"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "len"
> ">"
field_access
identifier "b"
. "."
identifier "length"
) ")"
block
{ "{"
expression_statement
assignment_expression
identifier "len"
= "="
field_access
identifier "b"
. "."
identifier "length"
; ";"
} "}"
expression_statement
assignment_expression
identifier "len"
= "="
method_invocation
identifier "read"
argument_list
( "("
identifier "b"
, ","
decimal_integer_literal "0"
, ","
identifier "len"
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "len"
== "=="
identifier "EOF"
) ")"
block
{ "{"
break_statement
break "break"
; ";"
} "}"
expression_statement
assignment_expression
identifier "total"
+= "+="
identifier "len"
; ";"
} "}"
return_statement
return "return"
identifier "total"
; ";"
} "}"
block_comment "/**\n * {@inheritDoc}\n *\n * @return <code>0</code"...
method_declaration
modifiers
public "public"
integral_type
int "int"
identifier "available"
formal_parameters
( "("
) ")"
throws
throws "throws"
type_identifier "IOException"
block
{ "{"
line_comment "// Note: the logic is similar to the InflaterInputStream:"
line_comment "// as long as we have not reached EOF, indicate that t"...
line_comment "// data available. As we do not know for sure how much"...
line_comment "// just return 1 as a safe guess."
line_comment "// use the EOF flag of the underlying codec instance"
if_statement
if "if"
parenthesized_expression
( "("
field_access
identifier "baseNCodec"
. "."
identifier "eof"
) ")"
block
{ "{"
return_statement
return "return"
decimal_integer_literal "0"
; ";"
} "}"
else "else"
block
{ "{"
return_statement
return "return"
decimal_integer_literal "1"
; ";"
} "}"
} "}"
} "}"