private void checkMagicChar(char expected, String position)
        throws IOException {
        int magic = this.in.read();
        if (magic != expected) {
            throw new IOException("Stream is not BZip2 formatted: expected '"
                                  + expected + "' as " + position + " byte but got '"
                                  + (char) magic + "'");
        }
    }