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–73 unchanged (73 lines)
74 /**
75 * The encoding to use for filenames and labels.
76 */
77 private final ZipEncoding zipEncoding;
78
79 // the provided encoding (for unit tests)
80
81 /**
82 * Constructor using the platform's default encoding for file
83 * names.
84 *
85 * @param is
86 * @throws ArchiveException
…lines 87–97 unchanged (11 lines)
98 * @since 1.6
99 */
100 public DumpArchiveInputStream(InputStream is, String encoding)
101 throws ArchiveException {
102 this.raw = new TapeInputStream(is);
103 this.hasHitEOF = false;
104 this.zipEncoding = ZipEncodingHelper.getZipEncoding(encoding);
105
106 try {
107 // read header, verify it's a dump archive.
108 byte[] headerBytes = raw.readRecord();
109
110 if (!DumpArchiveUtil.verify(headerBytes)) {
…lines 111–555 unchanged (445 lines)

After

…lines 1–73 unchanged (73 lines)
74 /**
75 * The encoding to use for filenames and labels.
76 */
77 private final ZipEncoding zipEncoding;
78
79 // the provided encoding (for unit tests)
80 final String encoding;
81
82 /**
83 * Constructor using the platform's default encoding for file
84 * names.
85 *
86 * @param is
…lines 87–98 unchanged (12 lines)
99 * @since 1.6
100 */
101 public DumpArchiveInputStream(InputStream is, String encoding)
102 throws ArchiveException {
103 this.raw = new TapeInputStream(is);
104 this.hasHitEOF = false;
105 this.encoding = encoding;
106 this.zipEncoding = ZipEncodingHelper.getZipEncoding(encoding);
107
108 try {
109 // read header, verify it's a dump archive.
110 byte[] headerBytes = raw.readRecord();
111
…lines 112–557 unchanged (446 lines)

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
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "compress"
. "."
identifier "archivers"
. "."
identifier "dump"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "compress"
. "."
identifier "archivers"
. "."
identifier "ArchiveException"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "compress"
. "."
identifier "archivers"
. "."
identifier "ArchiveInputStream"
; ";"
import_declaration (+22 nodes collapsed)
import_declaration (+22 nodes collapsed)
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "EOFException"
; ";"
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"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Arrays"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Comparator"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "HashMap"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Map"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "PriorityQueue"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Queue"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Stack"
; ";"
block_comment "/**\n * The DumpArchiveInputStream reads a UNIX dump archive "...
class_declaration
modifiers
public "public"
class "class"
identifier "DumpArchiveInputStream"
superclass
extends "extends"
type_identifier "ArchiveInputStream"
class_body
{ "{"
field_declaration
modifiers
private "private"
type_identifier "DumpArchiveSummary"
variable_declarator
identifier "summary"
; ";"
field_declaration
modifiers
private "private"
type_identifier "DumpArchiveEntry"
variable_declarator
identifier "active"
; ";"
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "isClosed"
; ";"
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "hasHitEOF"
; ";"
field_declaration
modifiers
private "private"
integral_type
long "long"
variable_declarator
identifier "entrySize"
; ";"
field_declaration
modifiers
private "private"
integral_type
long "long"
variable_declarator
identifier "entryOffset"
; ";"
field_declaration
modifiers
private "private"
integral_type
int "int"
variable_declarator
identifier "readIdx"
; ";"
field_declaration (+25 nodes collapsed)
field_declaration
modifiers
private "private"
array_type
integral_type
byte "byte"
dimensions
[ "["
] "]"
variable_declarator
identifier "blockBuffer"
; ";"
field_declaration
modifiers
private "private"
integral_type
int "int"
variable_declarator
identifier "recordOffset"
; ";"
field_declaration
modifiers
private "private"
integral_type
long "long"
variable_declarator
identifier "filepos"
; ";"
field_declaration
modifiers
protected "protected"
type_identifier "TapeInputStream"
variable_declarator
identifier "raw"
; ";"
line_comment "// map of ino -> dirent entry. We can use this to reconstruc"...
field_declaration (+29 nodes collapsed)
line_comment "// map of ino -> (directory) entry when we're missing one or"...
field_declaration (+29 nodes collapsed)
line_comment "// queue of (directory) entries where we now have the full p"...
field_declaration
modifiers
private "private"
generic_type
type_identifier "Queue"
type_arguments
< "<"
type_identifier "DumpArchiveEntry"
> ">"
variable_declarator
identifier "queue"
; ";"
block_comment "/**\n * The encoding to use for filenames and labels.\n "...
field_declaration
modifiers
private "private"
final "final"
type_identifier "ZipEncoding"
variable_declarator
identifier "zipEncoding"
; ";"
line_comment "// the provided encoding (for unit tests)"
block_comment "/**\n * Constructor using the platform's default encoding"...
constructor_declaration (+25 nodes collapsed)
block_comment "/**\n * Constructor.\n *\n * @param is\n * @para"...
constructor_declaration
modifiers
public "public"
identifier "DumpArchiveInputStream"
formal_parameters
( "("
formal_parameter
type_identifier "InputStream"
identifier "is"
, ","
formal_parameter
type_identifier "String"
identifier "encoding"
) ")"
throws
throws "throws"
type_identifier "ArchiveException"
constructor_body
{ "{"
expression_statement
assignment_expression
field_access
this "this"
. "."
identifier "raw"
= "="
object_creation_expression
new "new"
type_identifier "TapeInputStream"
argument_list
( "("
identifier "is"
) ")"
; ";"
expression_statement
assignment_expression
field_access
this "this"
. "."
identifier "hasHitEOF"
= "="
false "false"
; ";"
expression_statement
assignment_expression
field_access
this "this"
. "."
identifier "zipEncoding"
= "="
method_invocation
identifier "ZipEncodingHelper"
. "."
identifier "getZipEncoding"
argument_list
( "("
identifier "encoding"
) ")"
; ";"
try_statement (+158 nodes collapsed)
line_comment "// put in a dummy record for the root node."
local_variable_declaration (+22 nodes collapsed)
expression_statement
method_invocation
identifier "names"
. "."
identifier "put"
argument_list
( "("
decimal_integer_literal "2"
, ","
identifier "root"
) ")"
; ";"
line_comment "// use priority based on queue to ensure parent directories "...
line_comment "// released first."
expression_statement (+111 nodes collapsed)
} "}"
method_declaration (+31 nodes collapsed)
method_declaration (+25 nodes collapsed)
block_comment "/**\n * Return the archive summary information.\n */"
method_declaration
modifiers
public "public"
type_identifier "DumpArchiveSummary"
identifier "getSummary"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "summary"
; ";"
} "}"
block_comment "/**\n * Read CLRI (deleted inode) segment.\n */"
method_declaration (+160 nodes collapsed)
block_comment "/**\n * Read BITS segment.\n */"
method_declaration (+160 nodes collapsed)
block_comment "/**\n * Read the next entry.\n */"
method_declaration (+22 nodes collapsed)
block_comment "/**\n * Read the next entry.\n */"
method_declaration (+580 nodes collapsed)
block_comment "/**\n * Read directory entry.\n */"
method_declaration (+651 nodes collapsed)
block_comment "/**\n * Get full path for specified archive entry, or nul"...
method_declaration (+274 nodes collapsed)
block_comment "/**\n * Reads bytes from the current dump archive entry.\n"...
method_declaration (+418 nodes collapsed)
block_comment "/**\n * Closes the stream for this entry.\n */"
method_declaration (+43 nodes collapsed)
block_comment "/**\n * Look at the first few bytes of the file to decide"...
method_declaration (+89 nodes collapsed)
} "}"

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
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "compress"
. "."
identifier "archivers"
. "."
identifier "dump"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "compress"
. "."
identifier "archivers"
. "."
identifier "ArchiveException"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "compress"
. "."
identifier "archivers"
. "."
identifier "ArchiveInputStream"
; ";"
import_declaration (+22 nodes collapsed)
import_declaration (+22 nodes collapsed)
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "EOFException"
; ";"
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"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Arrays"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Comparator"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "HashMap"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Map"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "PriorityQueue"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Queue"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Stack"
; ";"
block_comment "/**\n * The DumpArchiveInputStream reads a UNIX dump archive "...
class_declaration
modifiers
public "public"
class "class"
identifier "DumpArchiveInputStream"
superclass
extends "extends"
type_identifier "ArchiveInputStream"
class_body
{ "{"
field_declaration
modifiers
private "private"
type_identifier "DumpArchiveSummary"
variable_declarator
identifier "summary"
; ";"
field_declaration
modifiers
private "private"
type_identifier "DumpArchiveEntry"
variable_declarator
identifier "active"
; ";"
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "isClosed"
; ";"
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "hasHitEOF"
; ";"
field_declaration
modifiers
private "private"
integral_type
long "long"
variable_declarator
identifier "entrySize"
; ";"
field_declaration
modifiers
private "private"
integral_type
long "long"
variable_declarator
identifier "entryOffset"
; ";"
field_declaration
modifiers
private "private"
integral_type
int "int"
variable_declarator
identifier "readIdx"
; ";"
field_declaration (+25 nodes collapsed)
field_declaration
modifiers
private "private"
array_type
integral_type
byte "byte"
dimensions
[ "["
] "]"
variable_declarator
identifier "blockBuffer"
; ";"
field_declaration
modifiers
private "private"
integral_type
int "int"
variable_declarator
identifier "recordOffset"
; ";"
field_declaration
modifiers
private "private"
integral_type
long "long"
variable_declarator
identifier "filepos"
; ";"
field_declaration
modifiers
protected "protected"
type_identifier "TapeInputStream"
variable_declarator
identifier "raw"
; ";"
line_comment "// map of ino -> dirent entry. We can use this to reconstruc"...
field_declaration (+29 nodes collapsed)
line_comment "// map of ino -> (directory) entry when we're missing one or"...
field_declaration (+29 nodes collapsed)
line_comment "// queue of (directory) entries where we now have the full p"...
field_declaration
modifiers
private "private"
generic_type
type_identifier "Queue"
type_arguments
< "<"
type_identifier "DumpArchiveEntry"
> ">"
variable_declarator
identifier "queue"
; ";"
block_comment "/**\n * The encoding to use for filenames and labels.\n "...
field_declaration
modifiers
private "private"
final "final"
type_identifier "ZipEncoding"
variable_declarator
identifier "zipEncoding"
; ";"
line_comment "// the provided encoding (for unit tests)"
field_declaration
modifiers
final "final"
type_identifier "String"
variable_declarator
identifier "encoding"
; ";"
block_comment "/**\n * Constructor using the platform's default encoding"...
constructor_declaration (+25 nodes collapsed)
block_comment "/**\n * Constructor.\n *\n * @param is\n * @para"...
constructor_declaration
modifiers
public "public"
identifier "DumpArchiveInputStream"
formal_parameters
( "("
formal_parameter
type_identifier "InputStream"
identifier "is"
, ","
formal_parameter
type_identifier "String"
identifier "encoding"
) ")"
throws
throws "throws"
type_identifier "ArchiveException"
constructor_body
{ "{"
expression_statement
assignment_expression
field_access
this "this"
. "."
identifier "raw"
= "="
object_creation_expression
new "new"
type_identifier "TapeInputStream"
argument_list
( "("
identifier "is"
) ")"
; ";"
expression_statement
assignment_expression
field_access
this "this"
. "."
identifier "hasHitEOF"
= "="
false "false"
; ";"
expression_statement
assignment_expression
field_access
this "this"
. "."
identifier "encoding"
= "="
identifier "encoding"
; ";"
expression_statement
assignment_expression
field_access
this "this"
. "."
identifier "zipEncoding"
= "="
method_invocation
identifier "ZipEncodingHelper"
. "."
identifier "getZipEncoding"
argument_list
( "("
identifier "encoding"
) ")"
; ";"
try_statement (+158 nodes collapsed)
line_comment "// put in a dummy record for the root node."
local_variable_declaration (+22 nodes collapsed)
expression_statement
method_invocation
identifier "names"
. "."
identifier "put"
argument_list
( "("
decimal_integer_literal "2"
, ","
identifier "root"
) ")"
; ";"
line_comment "// use priority based on queue to ensure parent directories "...
line_comment "// released first."
expression_statement (+111 nodes collapsed)
} "}"
method_declaration (+31 nodes collapsed)
method_declaration (+25 nodes collapsed)
block_comment "/**\n * Return the archive summary information.\n */"
method_declaration
modifiers
public "public"
type_identifier "DumpArchiveSummary"
identifier "getSummary"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "summary"
; ";"
} "}"
block_comment "/**\n * Read CLRI (deleted inode) segment.\n */"
method_declaration (+160 nodes collapsed)
block_comment "/**\n * Read BITS segment.\n */"
method_declaration (+160 nodes collapsed)
block_comment "/**\n * Read the next entry.\n */"
method_declaration (+22 nodes collapsed)
block_comment "/**\n * Read the next entry.\n */"
method_declaration (+580 nodes collapsed)
block_comment "/**\n * Read directory entry.\n */"
method_declaration (+651 nodes collapsed)
block_comment "/**\n * Get full path for specified archive entry, or nul"...
method_declaration (+274 nodes collapsed)
block_comment "/**\n * Reads bytes from the current dump archive entry.\n"...
method_declaration (+418 nodes collapsed)
block_comment "/**\n * Closes the stream for this entry.\n */"
method_declaration (+43 nodes collapsed)
block_comment "/**\n * Look at the first few bytes of the file to decide"...
method_declaration (+89 nodes collapsed)
} "}"