aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkUNKNOWN.java
blob: 15a35935ad73a58379641a070d6c72113b970fa0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package jogamp.opengl.util.pngj.chunks;

import jogamp.opengl.util.pngj.ImageInfo;

public class PngChunkUNKNOWN extends PngChunk { // unkown, custom or not

	private byte[] data;

	public PngChunkUNKNOWN(String id, ImageInfo info) {
		super(id, info);
	}

	@Override
	public boolean allowsMultiple() {
		return true;
	}

	private PngChunkUNKNOWN(PngChunkUNKNOWN c, ImageInfo info) {
		super(c.id, info);
		System.arraycopy(c.data, 0, data, 0, c.data.length);
	}

	@Override
	public ChunkRaw createChunk() {
		ChunkRaw p = createEmptyChunk(data.length, false);
		p.data = this.data;
		return p;
	}

	@Override
	public void parseFromChunk(ChunkRaw c) {
		data = c.data;
	}

	/* does not copy! */
	public byte[] getData() {
		return data;
	}

	/* does not copy! */
	public void setData(byte[] data) {
		this.data = data;
	}

	@Override
	public void cloneDataFromRead(PngChunk other) {
		// THIS SHOULD NOT BE CALLED IF ALREADY CLONED WITH COPY CONSTRUCTOR
		PngChunkUNKNOWN c = (PngChunkUNKNOWN) other;
		data = c.data; // not deep copy
	}
}