// Path: src/main/java/com/nothome/delta/GDiffWriter.java
// public static final int COPY_INT_INT = 254;
// 
// Path: src/main/java/com/nothome/delta/GDiffWriter.java
// public static final int COPY_INT_UBYTE = 252;
// 
// Path: src/main/java/com/nothome/delta/GDiffWriter.java
// public static final int COPY_INT_USHORT = 253;
// 
// Path: src/main/java/com/nothome/delta/GDiffWriter.java
// public static final int COPY_LONG_INT = 255;
// 
// Path: src/main/java/com/nothome/delta/GDiffWriter.java
// public static final int COPY_USHORT_INT = 251;
// 
// Path: src/main/java/com/nothome/delta/GDiffWriter.java
// public static final int COPY_USHORT_UBYTE = 249;
// 
// Path: src/main/java/com/nothome/delta/GDiffWriter.java
// public static final int COPY_USHORT_USHORT = 250;
// 
// Path: src/main/java/com/nothome/delta/GDiffWriter.java
// public static final int DATA_INT = 248;
// 
// Path: src/main/java/com/nothome/delta/GDiffWriter.java
// public static final int DATA_MAX = 246;
// 
// Path: src/main/java/com/nothome/delta/GDiffWriter.java
// public static final int DATA_USHORT = 247;
// 
// Path: src/main/java/com/nothome/delta/GDiffWriter.java
// public static final byte EOF = 0;


import static com.nothome.delta.GDiffWriter.COPY_INT_INT;
import static com.nothome.delta.GDiffWriter.COPY_INT_UBYTE;
import static com.nothome.delta.GDiffWriter.COPY_INT_USHORT;
import static com.nothome.delta.GDiffWriter.COPY_LONG_INT;
import static com.nothome.delta.GDiffWriter.COPY_USHORT_INT;
import static com.nothome.delta.GDiffWriter.COPY_USHORT_UBYTE;
import static com.nothome.delta.GDiffWriter.COPY_USHORT_USHORT;
import static com.nothome.delta.GDiffWriter.DATA_INT;
import static com.nothome.delta.GDiffWriter.DATA_MAX;
import static com.nothome.delta.GDiffWriter.DATA_USHORT;
import static com.nothome.delta.GDiffWriter.EOF;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.EOFException;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
    }
    while (true) {
      int command = patchIS.readUnsignedByte();
      if (command == EOF)
        break;
      int length;
      int offset;
      if (command <= DATA_MAX) {
        append(command, patchIS, outOS);
        continue;
      }
      switch (command) {
        case DATA_USHORT: // ushort, n bytes following; append
          length = patchIS.readUnsignedShort();
          append(length, patchIS, outOS);
          break;
        case DATA_INT: // int, n bytes following; append
          length = patchIS.readInt();
          append(length, patchIS, outOS);
          break;
        case COPY_USHORT_UBYTE:
          offset = patchIS.readUnsignedShort();
          length = patchIS.readUnsignedByte();
          copy(offset, length, source, outOS);
          break;
        case COPY_USHORT_USHORT:
          offset = patchIS.readUnsignedShort();
          length = patchIS.readUnsignedShort();
          copy(offset, length, source, outOS);
          break;
// Path: src/main/java/com/nothome/delta/GDiffWriter.java
// public static final int COPY_INT_INT = 254;
// 
// Path: src/main/java/com/nothome/delta/GDiffWriter.java
// public static final int COPY_INT_UBYTE = 252;
// 
// Path: src/main/java/com/nothome/delta/GDiffWriter.java
// public static final int COPY_INT_USHORT = 253;
// 
// Path: src/main/java/com/nothome/delta/GDiffWriter.java
// public static final int COPY_LONG_INT = 255;
// 
// Path: src/main/java/com/nothome/delta/GDiffWriter.java
// public static final int COPY_USHORT_INT = 251;
// 
// Path: src/main/java/com/nothome/delta/GDiffWriter.java
// public static final int COPY_USHORT_UBYTE = 249;
// 
// Path: src/main/java/com/nothome/delta/GDiffWriter.java
// public static final int COPY_USHORT_USHORT = 250;
// 
// Path: src/main/java/com/nothome/delta/GDiffWriter.java
// public static final int DATA_INT = 248;
// 
// Path: src/main/java/com/nothome/delta/GDiffWriter.java
// public static final int DATA_MAX = 246;
// 
// Path: src/main/java/com/nothome/delta/GDiffWriter.java
// public static final int DATA_USHORT = 247;
// 
// Path: src/main/java/com/nothome/delta/GDiffWriter.java
// public static final byte EOF = 0;


// Path: src/main/java/com/nothome/delta/GDiffPatcher.java
import static com.nothome.delta.GDiffWriter.COPY_INT_INT;
import static com.nothome.delta.GDiffWriter.COPY_INT_UBYTE;
import static com.nothome.delta.GDiffWriter.COPY_INT_USHORT;
import static com.nothome.delta.GDiffWriter.COPY_LONG_INT;
import static com.nothome.delta.GDiffWriter.COPY_USHORT_INT;
import static com.nothome.delta.GDiffWriter.COPY_USHORT_UBYTE;
import static com.nothome.delta.GDiffWriter.COPY_USHORT_USHORT;
import static com.nothome.delta.GDiffWriter.DATA_INT;
import static com.nothome.delta.GDiffWriter.DATA_MAX;
import static com.nothome.delta.GDiffWriter.DATA_USHORT;
import static com.nothome.delta.GDiffWriter.EOF;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.EOFException;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.RandomAccessFile;
import java.nio.ByteBuffer;

    }
    while (true) {
      int command = patchIS.readUnsignedByte();
      if (command == EOF)
        break;
      int length;
      int offset;
      if (command <= DATA_MAX) {
        append(command, patchIS, outOS);
        continue;
      }
      switch (command) {
        case DATA_USHORT: // ushort, n bytes following; append
          length = patchIS.readUnsignedShort();
          append(length, patchIS, outOS);
          break;
        case DATA_INT: // int, n bytes following; append
          length = patchIS.readInt();
          append(length, patchIS, outOS);
          break;
        case COPY_USHORT_UBYTE:
          offset = patchIS.readUnsignedShort();
          length = patchIS.readUnsignedByte();
          copy(offset, length, source, outOS);
          break;
        case COPY_USHORT_USHORT:
          offset = patchIS.readUnsignedShort();
          length = patchIS.readUnsignedShort();
          copy(offset, length, source, outOS);
          break;
        case COPY_USHORT_INT: