int version, byte[] id, String suffix) throws IOException { if (id.length != StringHelper.ID_LENGTH) { throw new IllegalArgumentException("Invalid id: " + StringHelper.idToString(id)); } writeHeader(out, codec, version); out.writeBytes(id, 0, id.length); BytesRef suffixBytes = new BytesRef(suffix); if (suffixBytes.length != suffix.length() || suffixBytes.length >= 256) { throw new IllegalArgumentException( "suffix must be simple ASCII, less than 256 characters in length [got " + suffix + "]"); } out.writeByte((byte) suffixBytes.length); out.writeBytes(suffixBytes.bytes, suffixBytes.offset, suffixBytes.length); } public static void writeHeader(DataOutput out, String codec, int version) throws IOException { BytesRef bytes = new BytesRef(codec); if (bytes.length != codec.length() || bytes.length >= 128) { throw new IllegalArgumentException( "codec must be simple ASCII, less than 128 characters in length [got " + codec + "]"); } writeBEInt(out, CODEC_MAGIC); out.writeString(codec); writeBEInt(out, version); } w ͯ͢ͷ Lucene ΠϯσοΫεϑΝΠϧʹɺઌ಄ʹڞ௨ͷϑΥʔϚοτͰϔομ ͕ॻ͔ΕΔ w ΠϯσοΫεϑΝΠϧͷϔομ (IndexHeader) CodecHeader ObjectID ObjectSuffix ͔ΒͳΔ w CodecUtil#writeIndexHeader() w CodecUtil#writeHeader() Ͱ CodecHeader Λॻ͘ w BEInt ͷϚδοΫφϯόʔ CODEC_MAGIC (= 0x3fd76c17) Λॻ͘ w String ͷίʔσοΫ໊ codec Λॻ͘ w BEInt ͷϑΝΠϧͷόʔδϣϯ version Λॻ͘ w DataOutput#writeBytes() Ͱ ObjectID Λॻ͘ w 1όΠτݻఆͰ SuffixBytes ͷ͞Λॻ͍ͨ͋ͱɺ SuffixBytes Λॻ͘