Class ChunkWriter

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class ChunkWriter
    extends java.lang.Object
    implements java.io.Closeable
    Maven 2 Index published binary chunk writer, it writes raw Maven Indexer records to the transport binary format.
    Since:
    5.1.2
    • Constructor Summary

      Constructors 
      Constructor Description
      ChunkWriter​(java.lang.String chunkName, java.io.OutputStream outputStream, int version, java.util.Date timestamp)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Closes this reader and it's underlying input.
      java.lang.String getName()
      Returns the chunk name.
      java.util.Date getTimestamp()
      Returns the index timestamp of last update of the index.
      int getVersion()
      Returns index version.
      int writeChunk​(java.util.Iterator<java.util.Map<java.lang.String,​java.lang.String>> iterator)
      Writes out the record iterator and returns the written record count.
      private static void writeField​(java.lang.String fieldName, java.lang.String fieldValue, java.io.DataOutput dataOutput)  
      private static void writeRecord​(java.util.Map<java.lang.String,​java.lang.String> record, java.io.DataOutput dataOutput)  
      private static void writeUTF​(java.lang.String str, java.io.DataOutput dataOutput)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • chunkName

        private final java.lang.String chunkName
      • dataOutputStream

        private final java.io.DataOutputStream dataOutputStream
      • version

        private final int version
      • timestamp

        private final java.util.Date timestamp
    • Constructor Detail

      • ChunkWriter

        public ChunkWriter​(java.lang.String chunkName,
                           java.io.OutputStream outputStream,
                           int version,
                           java.util.Date timestamp)
                    throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • getName

        public java.lang.String getName()
        Returns the chunk name.
      • getVersion

        public int getVersion()
        Returns index version. All releases so far always returned 1.
      • getTimestamp

        public java.util.Date getTimestamp()
        Returns the index timestamp of last update of the index.
      • writeChunk

        public int writeChunk​(java.util.Iterator<java.util.Map<java.lang.String,​java.lang.String>> iterator)
                       throws java.io.IOException
        Writes out the record iterator and returns the written record count.
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Closes this reader and it's underlying input.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException
      • writeRecord

        private static void writeRecord​(java.util.Map<java.lang.String,​java.lang.String> record,
                                        java.io.DataOutput dataOutput)
                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • writeField

        private static void writeField​(java.lang.String fieldName,
                                       java.lang.String fieldValue,
                                       java.io.DataOutput dataOutput)
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • writeUTF

        private static void writeUTF​(java.lang.String str,
                                     java.io.DataOutput dataOutput)
                              throws java.io.IOException
        Throws:
        java.io.IOException