1
package org.jaudiotagger.audio.asf.io;
3
import org.jaudiotagger.audio.asf.data.GUID;
5
import java.util.Arrays;
6
import java.util.HashSet;
10
* Structure to tell the differences occurred by altering a chunk.
12
* @author Christian Laireiter
14
final class ModificationResult {
17
* Stores the difference of bytes.<br>
19
private final long byteDifference;
22
* Stores the difference of the amount of chunks.<br>
23
* "-1" if the chunk disappeared upon modification.<br>
24
* "0" if the chunk was just modified.<br>
25
* "1" if a chunk has been created.<br>
27
private final int chunkDifference;
30
* Stores all GUIDs, which have been read.<br>
32
private final Set<GUID> occuredGUIDs = new HashSet<GUID>();
35
* Creates an instance.<br>
37
* @param chunkCountDiff
38
* amount of chunks appeared, disappeared
40
* amount of bytes added or removed.
42
* all GUIDs which have been occurred, during processing
44
public ModificationResult(final int chunkCountDiff, final long bytesDiffer,
45
final GUID... occurred) {
46
assert occurred != null && occurred.length > 0;
47
this.chunkDifference = chunkCountDiff;
48
this.byteDifference = bytesDiffer;
49
this.occuredGUIDs.addAll(Arrays.asList(occurred));
53
* Creates an instance.<br>
55
* @param chunkCountDiff
56
* amount of chunks appeared, disappeared
58
* amount of bytes added or removed.
60
* all GUIDs which have been occurred, during processing
62
public ModificationResult(final int chunkCountDiff, final long bytesDiffer,
63
final Set<GUID> occurred) {
64
this.chunkDifference = chunkCountDiff;
65
this.byteDifference = bytesDiffer;
66
this.occuredGUIDs.addAll(occurred);
70
* Returns the difference of bytes.
72
* @return the byte difference
74
public long getByteDifference() {
75
return this.byteDifference;
79
* Returns the difference of the amount of chunks.
81
* @return the chunk count difference
83
public int getChunkCountDifference() {
84
return this.chunkDifference;
88
* Returns all GUIDs which have been occurred during processing.
90
* @return see description.s
92
public Set<GUID> getOccuredGUIDs() {
93
return new HashSet<GUID>(this.occuredGUIDs);
1
package org.jaudiotagger.audio.asf.io;
3
import org.jaudiotagger.audio.asf.data.GUID;
5
import java.util.Arrays;
6
import java.util.HashSet;
10
* Structure to tell the differences occurred by altering a chunk.
12
* @author Christian Laireiter
14
final class ModificationResult {
17
* Stores the difference of bytes.<br>
19
private final long byteDifference;
22
* Stores the difference of the amount of chunks.<br>
23
* "-1" if the chunk disappeared upon modification.<br>
24
* "0" if the chunk was just modified.<br>
25
* "1" if a chunk has been created.<br>
27
private final int chunkDifference;
30
* Stores all GUIDs, which have been read.<br>
32
private final Set<GUID> occuredGUIDs = new HashSet<GUID>();
35
* Creates an instance.<br>
37
* @param chunkCountDiff
38
* amount of chunks appeared, disappeared
40
* amount of bytes added or removed.
42
* all GUIDs which have been occurred, during processing
44
public ModificationResult(final int chunkCountDiff, final long bytesDiffer,
45
final GUID... occurred) {
46
assert occurred != null && occurred.length > 0;
47
this.chunkDifference = chunkCountDiff;
48
this.byteDifference = bytesDiffer;
49
this.occuredGUIDs.addAll(Arrays.asList(occurred));
53
* Creates an instance.<br>
55
* @param chunkCountDiff
56
* amount of chunks appeared, disappeared
58
* amount of bytes added or removed.
60
* all GUIDs which have been occurred, during processing
62
public ModificationResult(final int chunkCountDiff, final long bytesDiffer,
63
final Set<GUID> occurred) {
64
this.chunkDifference = chunkCountDiff;
65
this.byteDifference = bytesDiffer;
66
this.occuredGUIDs.addAll(occurred);
70
* Returns the difference of bytes.
72
* @return the byte difference
74
public long getByteDifference() {
75
return this.byteDifference;
79
* Returns the difference of the amount of chunks.
81
* @return the chunk count difference
83
public int getChunkCountDifference() {
84
return this.chunkDifference;
88
* Returns all GUIDs which have been occurred during processing.
90
* @return see description.s
92
public Set<GUID> getOccuredGUIDs() {
93
return new HashSet<GUID>(this.occuredGUIDs);