Skip to content

Instantly share code, notes, and snippets.

@GaeaKat
Created February 9, 2015 00:44
Show Gist options
  • Save GaeaKat/7f08ffa608783c9d61dc to your computer and use it in GitHub Desktop.
Save GaeaKat/7f08ffa608783c9d61dc to your computer and use it in GitHub Desktop.
package com.nekokittygames.zmachine.blorb.IFF;
import com.sun.javaws.exceptions.InvalidArgumentException;
/**
* Single chunk in an IFF file, may contain more chunks
*
*
* Created by Katrina Swales on 09/02/2015.
*/
public abstract class Chunk {
private String identifier;
private int size;
/**
* gets the chunk identifier
* @return identifying 4 letter string for chunk
*/
public String getIdentifier() {
return identifier;
}
/**
* Sets 4 letter chunk ident
* @param identifier ident to set
* @throws IllegalArgumentException thrown if ident wished is not 4 characters
*/
public void setIdentifier(String identifier){
if(identifier.length()!=4)
throw new IllegalArgumentException("Identifier must have 4 letters");
this.identifier = identifier;
}
/**
* Gets the size of the chunk
* @return size of chunk in bytes
*/
public int getSize() {
return size;
}
/**
* Sets the size of the chunk
* @param size size of chunk in bytes
*/
public void setSize(int size) {
this.size = size;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment