flags[stack.getDepth()] = FLAG_FIRST_ELEMENT;
}
public void writeArrayEnd(boolean check) throws IOException {
if(!stack.topIsArray()) {
throw new MessageTypeException("writeArrayEnd() is called but writeArrayBegin() is not called");
}
int remain = stack.getTopCount();
if(remain > 0) {
if(check) {
throw new MessageTypeException("writeArrayEnd(check=true) is called but the array is not end: "+remain);
}
for(int i=0; i < remain; i++) {
writeNil();
}
}