Examples of RandomAccessFileOutputStream


Examples of org.jwat.common.RandomAccessFileOutputStream

        GzipWriter writer = null;

        String in_file = "IAH-20080430204825-00000-blackbook.warc.gz";

        RandomAccessFile raf;
        RandomAccessFileOutputStream out;

        try {
            File out_file1 = File.createTempFile("jwat-testwrite3-", ".gz");
            File out_file2 = File.createTempFile("jwat-testwrite4-", ".gz");
            out_file1.deleteOnExit();
            out_file2.deleteOnExit();

            in = this.getClass().getClassLoader().getResourceAsStream(in_file);
            pbin = new ByteCountingPushBackInputStream(in, 16);
            reader = new GzipReader(pbin);

            raf = new RandomAccessFile(out_file1, "rw");
            raf.seek(0);
            raf.setLength(0);
            out = new RandomAccessFileOutputStream(raf);
            writer = new GzipWriter(out);

            cloneEntries(reader, writer);
            pbin.close();

            out.flush();
            out.close();
            raf.close();

            Assert.assertTrue(reader.isCompliant());
            Assert.assertEquals(reader.bIsCompliant, reader.isCompliant());
            Assert.assertTrue(writer.isCompliant());
            Assert.assertEquals(writer.bIsCompliant, writer.isCompliant());

            reader.close();
            writer.close();

            Assert.assertTrue(reader.isCompliant());
            Assert.assertEquals(reader.bIsCompliant, reader.isCompliant());
            Assert.assertTrue(writer.isCompliant());
            Assert.assertEquals(writer.bIsCompliant, writer.isCompliant());

            in = this.getClass().getClassLoader().getResourceAsStream(in_file);
            pbin = new ByteCountingPushBackInputStream(in, 16);
            reader = new GzipReader(pbin, 8192);

            raf = new RandomAccessFile(out_file2, "rw");
            raf.seek(0);
            raf.setLength(0);
            out = new RandomAccessFileOutputStream(raf);
            writer = new GzipWriter(out);

            cloneEntries(reader, writer);
            pbin.close();

            out.flush();
            out.close();
            raf.close();

            Assert.assertTrue(reader.isCompliant());
            Assert.assertEquals(reader.bIsCompliant, reader.isCompliant());
            Assert.assertTrue(writer.isCompliant());
View Full Code Here

Examples of org.pdfbox.io.RandomAccessFileOutputStream

        if( length == 0 )
        {
            //if the length is zero then don't bother trying to decode
            //some filters don't work when attempting to decode
            //with a zero length stream.  See zlib_error_01.pdf
            unFilteredStream = new RandomAccessFileOutputStream( file );
            done = true;
        }
        else
        {
            //ok this is a simple hack, sometimes we read a couple extra
            //bytes that shouldn't be there, so we encounter an error we will just
            //try again with one less byte.
            for( int tryCount=0; !done && tryCount<5; tryCount++ )
            {
                try
                {
                    input = new BufferedInputStream(
                        new RandomAccessFileInputStream( file, position, length ), BUFFER_SIZE );
                    unFilteredStream = new RandomAccessFileOutputStream( file );
                    filter.decode( input, unFilteredStream, this );
                    done = true;
                }
                catch( IOException io )
                {
View Full Code Here

Examples of org.pdfbox.io.RandomAccessFileOutputStream

        InputStream input;

        input = new BufferedInputStream(
            new RandomAccessFileInputStream( file, filteredStream.getPosition(),
                                                   filteredStream.getLength() ), BUFFER_SIZE );
        filteredStream = new RandomAccessFileOutputStream( file );
        filter.encode( input, filteredStream, this );
    }
View Full Code Here

Examples of org.pdfbox.io.RandomAccessFileOutputStream

     *
     * @throws IOException If there is an error creating the stream.
     */
    public OutputStream createFilteredStream() throws IOException
    {
        filteredStream = new RandomAccessFileOutputStream( file );
        unFilteredStream = null;
        return new BufferedOutputStream( filteredStream, BUFFER_SIZE );
    }
View Full Code Here

Examples of org.pdfbox.io.RandomAccessFileOutputStream

     *
     * @throws IOException If there is an error creating the stream.
     */
    public OutputStream createFilteredStream( COSBase expectedLength ) throws IOException
    {
        filteredStream = new RandomAccessFileOutputStream( file );
        filteredStream.setExpectedLength( expectedLength );
        unFilteredStream = null;
        return new BufferedOutputStream( filteredStream, BUFFER_SIZE );
    }
View Full Code Here

Examples of org.pdfbox.io.RandomAccessFileOutputStream

     *
     * @throws IOException If there is an error creating the stream.
     */
    public OutputStream createUnfilteredStream() throws IOException
    {
        unFilteredStream = new RandomAccessFileOutputStream( file );
        filteredStream = null;
        return new BufferedOutputStream( unFilteredStream, BUFFER_SIZE );
    }
View Full Code Here

Examples of org.pdfbox.io.RandomAccessFileOutputStream

        for( int tryCount=0; !done && tryCount<5; tryCount++ )
        {
            try
            {
                input = new RandomAccessFileInputStream( file, position, length );
                unFilteredStream = new RandomAccessFileOutputStream( file );
                filter.decode( input, unFilteredStream, dic );
                done = true;
            }
            catch( IOException io )
            {
View Full Code Here

Examples of org.pdfbox.io.RandomAccessFileOutputStream

        FilterManager manager = getFilterManager();
        Filter filter = manager.getFilter( filterName );
        InputStream input;

        input = new RandomAccessFileInputStream( file, filteredStream.getPosition(), filteredStream.getLength() );
        filteredStream = new RandomAccessFileOutputStream( file );
        filter.encode( input, filteredStream, dic );
    }
View Full Code Here

Examples of org.pdfbox.io.RandomAccessFileOutputStream

     *
     * @throws IOException If there is an error creating the stream.
     */
    public OutputStream createFilteredStream() throws IOException
    {
        filteredStream = new RandomAccessFileOutputStream( file );
        unFilteredStream = null;
        return filteredStream;
    }
View Full Code Here

Examples of org.pdfbox.io.RandomAccessFileOutputStream

     *
     * @throws IOException If there is an error creating the stream.
     */
    public OutputStream createFilteredStream( COSBase expectedLength ) throws IOException
    {
        filteredStream = new RandomAccessFileOutputStream( file );
        filteredStream.setExpectedLength( expectedLength );
        unFilteredStream = null;
        return filteredStream;
    }
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.