hollow/src/main/java/com/netflix/hollow/core/write/HollowBlobHeaderWriter.java
public void writeHeader(HollowBlobHeader header, DataOutputStream dos) throws IOException {
        /// save 4 bytes to indicate FastBlob version header.  This will be changed to indicate backwards incompatibility.
        dos.writeInt(HollowBlobHeader.HOLLOW_BLOB_VERSION_HEADER);

        /// Write randomized tag data -- every state gets a random 64-bit tag.
        /// When attempting to apply a delta, the originating state's random 64-bit tag is compared against the current 64-bit tag.
        /// This prevents deltas from being applied to incorrect states.
        dos.writeLong(header.getOriginRandomizedTag());
        dos.writeLong(header.getDestinationRandomizedTag());

        /// write the schemas contained in this blob to the stream in the pre v2.2.0 backwards compatibility envelope
        ByteArrayOutputStream schemasStream = new ByteArrayOutputStream();
        VarInt.writeVInt(schemasStream, header.getSchemas().size());
        for(HollowSchema schema : header.getSchemas())
            schema.writeTo(schemasStream);
        byte[] schemasData = schemasStream.toByteArray();
        
        VarInt.writeVInt(dos, schemasData.length + 1); // plus one byte for new backwards compatibility envelope.
        dos.write(schemasData);
        
        ///backwards compatibility -- new data can be added here by first indicating number of bytes used, will be skipped by existing readers.
        VarInt.writeVInt(dos, 0);

        /// write the header tags -- intended to include input source data versions
        dos.writeShort(header.getHeaderTags().size());

        for (Map.Entry<String, String> headerTag : header.getHeaderTags().entrySet()) {
            dos.writeUTF(headerTag.getKey());
            dos.writeUTF(headerTag.getValue());
        }
    }
public void writeHeader(HollowBlobHeader header, DataOutputStream dos) throws IOException {
        /// save 4 bytes to indicate FastBlob version header.  This will be changed to indicate backwards incompatibility.
        dos.writeInt(HollowBlobHeader.HOLLOW_BLOB_VERSION_HEADER);

        /// Write randomized tag data -- every state gets a random 64-bit tag.
        /// When attempting to apply a delta, the originating state's random 64-bit tag is compared against the current 64-bit tag.
        /// This prevents deltas from being applied to incorrect states.
        dos.writeLong(header.getOriginRandomizedTag());
        dos.writeLong(header.getDestinationRandomizedTag());

        /// write the schemas contained in this blob to the stream in the pre v2.2.0 backwards compatibility envelope
        ByteArrayOutputStream schemasStream = new ByteArrayOutputStream();
        VarInt.writeVInt(schemasStream, header.getSchemas().size());
        for(HollowSchema schema : header.getSchemas())
            schema.writeTo(schemasStream);
        byte[] schemasData = schemasStream.toByteArray();
        
        VarInt.writeVInt(dos, schemasData.length + 1); // plus one byte for new backwards compatibility envelope.
        dos.write(schemasData);
        
        ///backwards compatibility -- new data can be added here by first indicating number of bytes used, will be skipped by existing readers.
        VarInt.writeVInt(dos, 0);

        /// write the header tags -- intended to include input source data versions
        dos.writeShort(header.getHeaderTags().size());

        for (Map.Entry<String, String> headerTag : header.getHeaderTags().entrySet()) {
            dos.writeUTF(headerTag.getKey());
            dos.writeUTF(headerTag.getValue());
        }
    }
public void writeHeader ( HollowBlobHeader header , DataOutputStream dos ) throws IOException { /// save 4 bytes to indicate FastBlob version header.  This will be changed to indicate backwards incompatibility. dos . writeInt ( HollowBlobHeader . HOLLOW_BLOB_VERSION_HEADER ) ; /// Write randomized tag data -- every state gets a random 64-bit tag. /// When attempting to apply a delta, the originating state's random 64-bit tag is compared against the current 64-bit tag. /// This prevents deltas from being applied to incorrect states. dos . writeLong ( header . getOriginRandomizedTag ( ) ) ; dos . writeLong ( header . getDestinationRandomizedTag ( ) ) ; /// write the schemas contained in this blob to the stream in the pre v2.2.0 backwards compatibility envelope ByteArrayOutputStream schemasStream = new ByteArrayOutputStream ( ) ; VarInt . writeVInt ( schemasStream , header . getSchemas ( ) . size ( ) ) ; for ( HollowSchema schema : header . getSchemas ( ) ) schema . writeTo ( schemasStream ) ; byte [ ] schemasData = schemasStream . toByteArray ( ) ; VarInt . writeVInt ( dos , schemasData . length + 1 ) ; // plus one byte for new backwards compatibility envelope. dos . write ( schemasData ) ; ///backwards compatibility -- new data can be added here by first indicating number of bytes used, will be skipped by existing readers. VarInt . writeVInt ( dos , 0 ) ; /// write the header tags -- intended to include input source data versions dos . writeShort ( header . getHeaderTags ( ) . size ( ) ) ; for ( Map . Entry < String , String > headerTag : header . getHeaderTags ( ) . entrySet ( ) ) { dos . writeUTF ( headerTag . getKey ( ) ) ; dos . writeUTF ( headerTag . getValue ( ) ) ; } }
Write the header to the data output stream
@param header the blob header
@param dos the data output stream to write the blov header
@throws IOException if the blob header could not be written
Write the header to the data output stream