// Path: src/main/java/org/rr/mobi4java/ByteUtils.java
// public static byte[] getBytes(byte[] buffer, int offset) {
// 	byte[] b = new byte[buffer.length - offset];
// 	System.arraycopy(buffer, offset, b, 0, buffer.length - offset);
// 	return b;
// }
// 
// Path: src/main/java/org/rr/mobi4java/ByteUtils.java
// public static int getInt(byte[] buffer, int offset, int length) {
// 	return getInt(getBytes(buffer, offset, length));
// }
// 
// Path: src/main/java/org/rr/mobi4java/ByteUtils.java
// public static String getString(byte[] buffer, int offset, int length) {
// 	return getString(getBytes(buffer, offset, length));
// }
// 
// Path: src/main/java/org/rr/mobi4java/ByteUtils.java
// public static void write(byte[] data, OutputStream out) throws IOException {
// 	write(data, data.length, out);
// }
// 
// Path: src/main/java/org/rr/mobi4java/ByteUtils.java
// public static void writeInt(int data, int length, OutputStream out) throws IOException {
// 	out.write(getBytes(data, new byte[length]), 0, length);
// }
// 
// Path: src/main/java/org/rr/mobi4java/ByteUtils.java
// public static void writeString(String data, int length, OutputStream out) throws IOException {
// 	byte[] s = getBytes(data);
// 	byte[] b = new byte[length];
// 	System.arraycopy(s, 0, b, 0, s.length);
// 	out.write(b, 0, length);
// }


import static org.apache.commons.lang3.BooleanUtils.negate;
import static org.rr.mobi4java.ByteUtils.getBytes;
import static org.rr.mobi4java.ByteUtils.getInt;
import static org.rr.mobi4java.ByteUtils.getString;
import static org.rr.mobi4java.ByteUtils.write;
import static org.rr.mobi4java.ByteUtils.writeInt;
import static org.rr.mobi4java.ByteUtils.writeString;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.io.output.TeeOutputStream;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
			
			rest = getBytes(content, tagxIndex + tagx.getSize());
		} else {
			rest = getBytes(content, headerLength);
		}
	}
	
	@Override
	byte[] writeContent(OutputStream out) throws IOException {
		ByteArrayOutputStream branch = new ByteArrayOutputStream();
		TeeOutputStream tee = new TeeOutputStream(out, branch);
		writeString(IDENTIFIER, 4, tee);
		writeInt(headerLength, 4, tee);
		writeInt(indexType, 4, tee);
		writeInt(unknown1, 4, tee);
		writeInt(unknown2, 4, tee);
		writeInt(idxtIndex, 4, tee);
		writeInt(indexCount, 4, tee);
		writeInt(indexEncoding, 4, tee);
		writeInt(indexLanguage, 4, tee);
		writeInt(totalIndexCount, 4, tee);
		writeInt(ordtIndex, 4, tee);
		writeInt(ligtIndex, 4, tee);
		writeInt(ordtLigtEntriesCount, 4, tee);
		writeInt(cncxRecordCount, 4, tee);
		write(unknownIndxHeaderPart, out);
		
		if(tagx != null) {
			tagx.writeContent(tee);
		}
// Path: src/main/java/org/rr/mobi4java/ByteUtils.java
// public static byte[] getBytes(byte[] buffer, int offset) {
// 	byte[] b = new byte[buffer.length - offset];
// 	System.arraycopy(buffer, offset, b, 0, buffer.length - offset);
// 	return b;
// }
// 
// Path: src/main/java/org/rr/mobi4java/ByteUtils.java
// public static int getInt(byte[] buffer, int offset, int length) {
// 	return getInt(getBytes(buffer, offset, length));
// }
// 
// Path: src/main/java/org/rr/mobi4java/ByteUtils.java
// public static String getString(byte[] buffer, int offset, int length) {
// 	return getString(getBytes(buffer, offset, length));
// }
// 
// Path: src/main/java/org/rr/mobi4java/ByteUtils.java
// public static void write(byte[] data, OutputStream out) throws IOException {
// 	write(data, data.length, out);
// }
// 
// Path: src/main/java/org/rr/mobi4java/ByteUtils.java
// public static void writeInt(int data, int length, OutputStream out) throws IOException {
// 	out.write(getBytes(data, new byte[length]), 0, length);
// }
// 
// Path: src/main/java/org/rr/mobi4java/ByteUtils.java
// public static void writeString(String data, int length, OutputStream out) throws IOException {
// 	byte[] s = getBytes(data);
// 	byte[] b = new byte[length];
// 	System.arraycopy(s, 0, b, 0, s.length);
// 	out.write(b, 0, length);
// }


// Path: src/main/java/org/rr/mobi4java/MobiContentIndex.java
import static org.apache.commons.lang3.BooleanUtils.negate;
import static org.rr.mobi4java.ByteUtils.getBytes;
import static org.rr.mobi4java.ByteUtils.getInt;
import static org.rr.mobi4java.ByteUtils.getString;
import static org.rr.mobi4java.ByteUtils.write;
import static org.rr.mobi4java.ByteUtils.writeInt;
import static org.rr.mobi4java.ByteUtils.writeString;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.io.output.TeeOutputStream;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;

			
			rest = getBytes(content, tagxIndex + tagx.getSize());
		} else {
			rest = getBytes(content, headerLength);
		}
	}
	
	@Override
	byte[] writeContent(OutputStream out) throws IOException {
		ByteArrayOutputStream branch = new ByteArrayOutputStream();
		TeeOutputStream tee = new TeeOutputStream(out, branch);
		writeString(IDENTIFIER, 4, tee);
		writeInt(headerLength, 4, tee);
		writeInt(indexType, 4, tee);
		writeInt(unknown1, 4, tee);
		writeInt(unknown2, 4, tee);
		writeInt(idxtIndex, 4, tee);
		writeInt(indexCount, 4, tee);
		writeInt(indexEncoding, 4, tee);
		writeInt(indexLanguage, 4, tee);
		writeInt(totalIndexCount, 4, tee);
		writeInt(ordtIndex, 4, tee);
		writeInt(ligtIndex, 4, tee);
		writeInt(ordtLigtEntriesCount, 4, tee);
		writeInt(cncxRecordCount, 4, tee);
		write(unknownIndxHeaderPart, out);
		
		if(tagx != null) {
			tagx.writeContent(tee);
		}
		write(rest, out);