~ubuntu-branches/ubuntu/utopic/libjaudiotagger-java/utopic

« back to all changes in this revision

Viewing changes to src/org/jaudiotagger/audio/asf/data/EncodingChunk.java

  • Committer: Bazaar Package Importer
  • Author(s): Damien Raude-Morvan
  • Date: 2011-04-28 23:52:43 UTC
  • mfrom: (3.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20110428235243-pzalvw6lncis3ukf
Tags: 2.0.3-1
* d/control: Drop Depends on default-jre per Debian Java Policy as its
  a library package.
* d/watch: Fix to directly monitor SVN tags.
* Switch to 3.0 (quilt) format.
* Bump Standards-Version to 3.9.2 (no changes needed).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Entagged Audio Tag library
3
 
 * Copyright (c) 2004-2005 Christian Laireiter <liree@web.de>
4
 
 * 
5
 
 * This library is free software; you can redistribute it and/or
6
 
 * modify it under the terms of the GNU Lesser General Public
7
 
 * License as published by the Free Software Foundation; either
8
 
 * version 2.1 of the License, or (at your option) any later version.
9
 
 *  
10
 
 * This library is distributed in the hope that it will be useful,
11
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
 
 * Lesser General Public License for more details.
14
 
 * 
15
 
 * You should have received a copy of the GNU Lesser General Public
16
 
 * License along with this library; if not, write to the Free Software
17
 
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
 
 */
19
 
package org.jaudiotagger.audio.asf.data;
20
 
 
21
 
import org.jaudiotagger.audio.asf.util.Utils;
22
 
 
23
 
import java.math.BigInteger;
24
 
import java.util.ArrayList;
25
 
import java.util.Collection;
26
 
import java.util.List;
27
 
 
28
 
/**
29
 
 * This class was intended to store the data of a chunk which contained the
30
 
 * encoding parameters in textual form. <br>
31
 
 * Since the needed parameters were found in other chunks the implementation of
32
 
 * this class was paused. <br>
33
 
 * TODO complete analysis.
34
 
 * 
35
 
 * @author Christian Laireiter
36
 
 */
37
 
public class EncodingChunk extends Chunk {
38
 
 
39
 
    /**
40
 
     * The read strings.
41
 
     */
42
 
    private final List<String> strings;
43
 
 
44
 
    /**
45
 
     * Creates an instance.
46
 
     * 
47
 
     * @param chunkLen
48
 
     *            Length of current chunk.
49
 
     */
50
 
    public EncodingChunk(final BigInteger chunkLen) {
51
 
        super(GUID.GUID_ENCODING, chunkLen);
52
 
        this.strings = new ArrayList<String>();
53
 
    }
54
 
 
55
 
    /**
56
 
     * This method appends a String.
57
 
     * 
58
 
     * @param toAdd
59
 
     *            String to add.
60
 
     */
61
 
    public void addString(final String toAdd) {
62
 
        this.strings.add(toAdd);
63
 
    }
64
 
 
65
 
    /**
66
 
     * This method returns a collection of all {@linkplain String Strings} which
67
 
     * were added due {@link #addString(String)}.
68
 
     * 
69
 
     * @return Inserted Strings.
70
 
     */
71
 
    public Collection<String> getStrings() {
72
 
        return new ArrayList<String>(this.strings);
73
 
    }
74
 
 
75
 
    /**
76
 
     * {@inheritDoc}
77
 
     */
78
 
    @Override
79
 
    public String prettyPrint(final String prefix) {
80
 
        final StringBuilder result = new StringBuilder(super
81
 
                .prettyPrint(prefix));
82
 
        this.strings.iterator();
83
 
        for (final String string : this.strings) {
84
 
            result.append(prefix).append("  | : ").append(string).append(
85
 
                    Utils.LINE_SEPARATOR);
86
 
        }
87
 
        return result.toString();
88
 
    }
 
1
/*
 
2
 * Entagged Audio Tag library
 
3
 * Copyright (c) 2004-2005 Christian Laireiter <liree@web.de>
 
4
 * 
 
5
 * This library is free software; you can redistribute it and/or
 
6
 * modify it under the terms of the GNU Lesser General Public
 
7
 * License as published by the Free Software Foundation; either
 
8
 * version 2.1 of the License, or (at your option) any later version.
 
9
 *  
 
10
 * This library is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
13
 * Lesser General Public License for more details.
 
14
 * 
 
15
 * You should have received a copy of the GNU Lesser General Public
 
16
 * License along with this library; if not, write to the Free Software
 
17
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
18
 */
 
19
package org.jaudiotagger.audio.asf.data;
 
20
 
 
21
import org.jaudiotagger.audio.asf.util.Utils;
 
22
 
 
23
import java.math.BigInteger;
 
24
import java.util.ArrayList;
 
25
import java.util.Collection;
 
26
import java.util.List;
 
27
 
 
28
/**
 
29
 * This class was intended to store the data of a chunk which contained the
 
30
 * encoding parameters in textual form. <br>
 
31
 * Since the needed parameters were found in other chunks the implementation of
 
32
 * this class was paused. <br>
 
33
 * TODO complete analysis.
 
34
 * 
 
35
 * @author Christian Laireiter
 
36
 */
 
37
public class EncodingChunk extends Chunk {
 
38
 
 
39
    /**
 
40
     * The read strings.
 
41
     */
 
42
    private final List<String> strings;
 
43
 
 
44
    /**
 
45
     * Creates an instance.
 
46
     * 
 
47
     * @param chunkLen
 
48
     *            Length of current chunk.
 
49
     */
 
50
    public EncodingChunk(final BigInteger chunkLen) {
 
51
        super(GUID.GUID_ENCODING, chunkLen);
 
52
        this.strings = new ArrayList<String>();
 
53
    }
 
54
 
 
55
    /**
 
56
     * This method appends a String.
 
57
     * 
 
58
     * @param toAdd
 
59
     *            String to add.
 
60
     */
 
61
    public void addString(final String toAdd) {
 
62
        this.strings.add(toAdd);
 
63
    }
 
64
 
 
65
    /**
 
66
     * This method returns a collection of all {@linkplain String Strings} which
 
67
     * were added due {@link #addString(String)}.
 
68
     * 
 
69
     * @return Inserted Strings.
 
70
     */
 
71
    public Collection<String> getStrings() {
 
72
        return new ArrayList<String>(this.strings);
 
73
    }
 
74
 
 
75
    /**
 
76
     * {@inheritDoc}
 
77
     */
 
78
    @Override
 
79
    public String prettyPrint(final String prefix) {
 
80
        final StringBuilder result = new StringBuilder(super
 
81
                .prettyPrint(prefix));
 
82
        this.strings.iterator();
 
83
        for (final String string : this.strings) {
 
84
            result.append(prefix).append("  | : ").append(string).append(
 
85
                    Utils.LINE_SEPARATOR);
 
86
        }
 
87
        return result.toString();
 
88
    }
89
89
}
 
 
b'\\ No newline at end of file'