org.apache.lens.lib.query
Class ZipFileFormatter

java.lang.Object
  extended by org.apache.lens.lib.query.AbstractOutputFormatter
      extended by org.apache.lens.lib.query.AbstractFileFormatter
          extended by org.apache.lens.lib.query.ZipFileFormatter
All Implemented Interfaces:
FileFormatter, QueryOutputFormatter

public class ZipFileFormatter
extends AbstractFileFormatter

Zip file formatter.

Creates a zip on hadoop compatible file system, with ability to split output across multiple part files and provide a final zip output file.


Field Summary
static String PART_SUFFIX
          The part suffix.
 
Fields inherited from class org.apache.lens.lib.query.AbstractOutputFormatter
HEADER_TYPE
 
Constructor Summary
ZipFileFormatter()
           
 
Method Summary
 void close()
          Close the formatter.
 void commit()
          Commit the formatting.
 String getEncoding()
          Get the result encoding, if any
 org.apache.hadoop.fs.Path getTmpPath()
          Get the temporary path of the result, if any
 void setupOutputs()
          Setup outputs for file formatter.
 void writeFooter(String footer)
          Write the footer passed.
 void writeHeader()
          Write the header.
 void writeHeader(String header)
          Write the header passed.
 void writeRow(String row)
          Write the row passed.
 
Methods inherited from class org.apache.lens.lib.query.AbstractFileFormatter
getFinalOutputPath, getNumRows, init, writeFooter
 
Methods inherited from class org.apache.lens.lib.query.AbstractOutputFormatter
getMetadata
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PART_SUFFIX

public static final String PART_SUFFIX
The part suffix.

See Also:
Constant Field Values
Constructor Detail

ZipFileFormatter

public ZipFileFormatter()
Method Detail

setupOutputs

public void setupOutputs()
                  throws IOException
Description copied from interface: FileFormatter
Setup outputs for file formatter.

Throws:
IOException - Signals that an I/O exception has occurred.

commit

public void commit()
            throws IOException
Description copied from interface: QueryOutputFormatter
Commit the formatting.

This will make the result consumable by user, will be called after all the writes succeed.

Throws:
IOException - Signals that an I/O exception has occurred.

close

public void close()
           throws IOException
Description copied from interface: QueryOutputFormatter
Close the formatter. Cleanup any resources.

Throws:
IOException - Signals that an I/O exception has occurred.

writeHeader

public void writeHeader(String header)
                 throws IOException
Description copied from interface: FileFormatter
Write the header passed.

Parameters:
header - the header
Throws:
IOException - Signals that an I/O exception has occurred.

writeFooter

public void writeFooter(String footer)
                 throws IOException
Description copied from interface: FileFormatter
Write the footer passed.

Parameters:
footer - the footer
Throws:
IOException - Signals that an I/O exception has occurred.

writeRow

public void writeRow(String row)
              throws IOException
Description copied from interface: FileFormatter
Write the row passed.

Parameters:
row - the row
Throws:
IOException - Signals that an I/O exception has occurred.

writeHeader

public void writeHeader()
                 throws IOException
Description copied from interface: QueryOutputFormatter
Write the header.

Specified by:
writeHeader in interface QueryOutputFormatter
Overrides:
writeHeader in class AbstractFileFormatter
Throws:
IOException - Signals that an I/O exception has occurred.

getTmpPath

public org.apache.hadoop.fs.Path getTmpPath()
Description copied from interface: FileFormatter
Get the temporary path of the result, if any

Returns:

getEncoding

public String getEncoding()
Description copied from interface: FileFormatter
Get the result encoding, if any

Returns:


Copyright © 2014–2015 Apache Software Foundation. All rights reserved.