Examples of CBZip2OutputStream


Examples of org.apache.tools.bzip2.CBZip2OutputStream

                return new GZIPOutputStream(ostream);
            } else {
                if (BZIP2.equals(value)) {
                    ostream.write('B');
                    ostream.write('Z');
                    return new CBZip2OutputStream(ostream);
                }
            }
            return ostream;
        }
View Full Code Here

Examples of org.apache.tools.bzip2r.CBZip2OutputStream

    OutputStream os = null;
    switch (comp) {
    case bz:
    case bz2:
      os = fs.create(fieldValueBasedPath.suffix(".bz2"), false);
      os = new CBZip2OutputStream(os);
      break;
    case gz:
      os = fs.create(fieldValueBasedPath.suffix(".gz"), false);
      os = new GZIPOutputStream(os);
      break;
View Full Code Here

Examples of org.apache.tools.bzip2r.CBZip2OutputStream

       
        File out = File.createTempFile("junit", ".bz2");
        out.deleteOnExit();
        out.delete();
              
        CBZip2OutputStream cos =
            new CBZip2OutputStream(new FileOutputStream(in));
        for (int i = 1; i < 100; i++) {
            StringBuffer sb = new StringBuffer();
            sb.append(i).append("\n").append(-i).append("\n");
            byte bytes[] = sb.toString().getBytes();
            cos.write(bytes);
        }
        cos.close();
                      
        pig.registerQuery("AA = load '"
                + Util.generateURI(in.getAbsolutePath(), pig.getPigContext())
                + "';");
        pig.registerQuery("A = foreach (group (filter AA by $0 > 0) all) generate flatten($1);");
View Full Code Here

Examples of org.apache.tools.bzip2r.CBZip2OutputStream

       
        File out = File.createTempFile("junit", ".bz2");
        out.deleteOnExit();
        out.delete();
              
        CBZip2OutputStream cos =
            new CBZip2OutputStream(new FileOutputStream(in));
        for (int i = 1; i < 100; i++) {
            StringBuffer sb = new StringBuffer();
            sb.append(i).append("\n").append(-i).append("\n");
            byte bytes[] = sb.toString().getBytes();
            cos.write(bytes);
        }
        cos.close();
                      
        pig.registerQuery("AA = load '"
                + Util.generateURI(in.getAbsolutePath(), pig.getPigContext())
                + "';");
        pig.registerQuery("A = foreach (group (filter AA by $0 > 0) all) generate flatten($1);");
View Full Code Here

Examples of org.apache.tools.bzip2r.CBZip2OutputStream

        in.deleteOnExit();
        String unCompressedInputFileName = "testRecordDelims-uncomp.txt";
        Util.createInputFile(cluster, unCompressedInputFileName, inputData);
       
        try {
            CBZip2OutputStream cos =
                new CBZip2OutputStream(new FileOutputStream(in));
            for (int i = 0; i < inputData.length; i++) {
                StringBuffer sb = new StringBuffer();
                sb.append(inputData[i]).append("\n");
                byte bytes[] = sb.toString().getBytes();
                cos.write(bytes);
            }
            cos.close();
           
            Util.copyFromLocalToCluster(cluster, compressedInputFileName,
                    compressedInputFileName);
           
            // pig script to read uncompressed input
View Full Code Here

Examples of org.apache.tools.bzip2r.CBZip2OutputStream

     */
    @Test
    public void testEmptyBzip() throws Exception {
        File tmp = File.createTempFile("junit", ".tmp");
        tmp.deleteOnExit();
        CBZip2OutputStream cos = new CBZip2OutputStream(new FileOutputStream(
                tmp));
        cos.close();
        assertNotSame(0, tmp.length());
        FileSystem fs = FileSystem.getLocal(new Configuration(false));
        CBZip2InputStream cis = new CBZip2InputStream(
                fs.open(new Path(tmp.getAbsolutePath())));
        assertEquals(-1, cis.read(new byte[100]));
View Full Code Here

Examples of org.apache.tools.bzip2r.CBZip2OutputStream

       
        File out = File.createTempFile("junit", ".bz2");
        out.deleteOnExit();
        out.delete();
              
        CBZip2OutputStream cos =
            new CBZip2OutputStream(new FileOutputStream(in));
        for (int i = 1; i < 100; i++) {
            StringBuffer sb = new StringBuffer();
            sb.append(i).append("\n").append(-i).append("\n");
            byte bytes[] = sb.toString().getBytes();
            cos.write(bytes);
        }
        cos.close();
                      
        pig.registerQuery("AA = load '"
                + Util.generateURI(in.getAbsolutePath(), pig.getPigContext())
                + "';");
        pig.registerQuery("A = foreach (group (filter AA by $0 > 0) all) generate flatten($1);");
View Full Code Here

Examples of org.apache.tools.bzip2r.CBZip2OutputStream

       
        File out = File.createTempFile("junit", ".bz2");
        out.deleteOnExit();
        out.delete();
              
        CBZip2OutputStream cos =
            new CBZip2OutputStream(new FileOutputStream(in));
        for (int i = 1; i < 100; i++) {
            StringBuffer sb = new StringBuffer();
            sb.append(i).append("\n").append(-i).append("\n");
            byte bytes[] = sb.toString().getBytes();
            cos.write(bytes);
        }
        cos.close();
                      
        pig.registerQuery("AA = load '"
                + Util.generateURI(in.getAbsolutePath(), pig.getPigContext())
                + "';");
        pig.registerQuery("A = foreach (group (filter AA by $0 > 0) all) generate flatten($1);");
View Full Code Here

Examples of org.apache.tools.bzip2r.CBZip2OutputStream

        in.deleteOnExit();
        String unCompressedInputFileName = "testRecordDelims-uncomp.txt";
        Util.createInputFile(cluster, unCompressedInputFileName, inputData);
       
        try {
            CBZip2OutputStream cos =
                new CBZip2OutputStream(new FileOutputStream(in));
            for (int i = 0; i < inputData.length; i++) {
                StringBuffer sb = new StringBuffer();
                sb.append(inputData[i]).append("\n");
                byte bytes[] = sb.toString().getBytes();
                cos.write(bytes);
            }
            cos.close();
           
            Util.copyFromLocalToCluster(cluster, compressedInputFileName,
                    compressedInputFileName);
           
            // pig script to read uncompressed input
View Full Code Here

Examples of org.apache.tools.bzip2r.CBZip2OutputStream

     */
    @Test
    public void testEmptyBzip() throws Exception {
        File tmp = File.createTempFile("junit", ".tmp");
        tmp.deleteOnExit();
        CBZip2OutputStream cos = new CBZip2OutputStream(new FileOutputStream(
                tmp));
        cos.close();
        assertNotSame(0, tmp.length());
        FileSystem fs = FileSystem.getLocal(new Configuration(false));
        CBZip2InputStream cis = new CBZip2InputStream(
                fs.open(new Path(tmp.getAbsolutePath())), -1, tmp.length());
        assertEquals(-1, cis.read(new byte[100]));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.