Examples of TempFileInputStream


Examples of de.innovationgate.utils.TempFileInputStream

       
        // Delete temp dir
        WGUtils.delTree(dir);
       
        // Return input stream for zip file
        return new TempFileInputStream(zipFile);
       
    }
View Full Code Here

Examples of org.apache.jackrabbit.core.data.db.TempFileInputStream

public class TempFileInputStreamTest extends JUnitTest {

    public void testReadPastEOF() throws IOException {
        File temp = File.createTempFile("test", null);
        TempFileInputStream.writeToFileAndClose(new ByteArrayInputStream(new byte[1]), temp);
        TempFileInputStream in = new TempFileInputStream(temp);
        assertEquals(0, in.read());
        assertEquals(-1, in.read());
        assertEquals(-1, in.read());
        assertEquals(-1, in.read());
        in.close();
    }
View Full Code Here

Examples of org.apache.jackrabbit.core.data.db.TempFileInputStream

    }

    public void testMarkReset() throws IOException {
        File temp = File.createTempFile("test", null);
        TempFileInputStream.writeToFileAndClose(new ByteArrayInputStream(new byte[10]), temp);
        InputStream in = new BufferedInputStream(new TempFileInputStream(temp));
        in.mark(100);
        for (int i = 0; i < 10; i++) {
            assertEquals(0, in.read());
        }
        assertEquals(-1, in.read());
View Full Code Here

Examples of org.apache.jackrabbit.core.data.db.TempFileInputStream

public class TempFileInputStreamTest extends JUnitTest {

    public void testReadPastEOF() throws IOException {
        File temp = File.createTempFile("test", null);
        TempFileInputStream.writeToFileAndClose(new ByteArrayInputStream(new byte[1]), temp);
        TempFileInputStream in = new TempFileInputStream(temp, false);
        assertEquals(0, in.read());
        assertEquals(-1, in.read());
        assertEquals(-1, in.read());
        assertEquals(-1, in.read());
        in.close();
    }
View Full Code Here

Examples of org.apache.jackrabbit.core.data.db.TempFileInputStream

    }

    public void testMarkReset() throws IOException {
        File temp = File.createTempFile("test", null);
        TempFileInputStream.writeToFileAndClose(new ByteArrayInputStream(new byte[10]), temp);
        InputStream in = new BufferedInputStream(new TempFileInputStream(temp, false));
        in.mark(100);
        for (int i = 0; i < 10; i++) {
            assertEquals(0, in.read());
        }
        assertEquals(-1, in.read());
View Full Code Here

Examples of org.apache.jackrabbit.core.data.db.TempFileInputStream

     * @return returns true if it was able to reset the Stream
     */
    public boolean resetStream() {
      if (stream instanceof TempFileInputStream) {
        try {
          TempFileInputStream tempFileInputStream = (TempFileInputStream) stream;
          // Close it if it is not already closed ...
          tempFileInputStream.close();
          stream = new TempFileInputStream(tempFileInputStream.getFile(), true);
          return true;
        } catch (Exception e) {
          log.warn("Failed to create a new TempFileInputStream", e);
        }
      }
View Full Code Here

Examples of org.apache.jackrabbit.core.data.db.TempFileInputStream

public class TempFileInputStreamTest extends JUnitTest {

    public void testReadPastEOF() throws IOException {
        File temp = File.createTempFile("test", null);
        TempFileInputStream.writeToFileAndClose(new ByteArrayInputStream(new byte[1]), temp);
        TempFileInputStream in = new TempFileInputStream(temp);
        assertEquals(0, in.read());
        assertEquals(-1, in.read());
        assertEquals(-1, in.read());
        assertEquals(-1, in.read());
        in.close();
    }
View Full Code Here

Examples of org.apache.jackrabbit.vault.util.TempFileInputStream

        spool(out);
        out.close();
        if (out.isInMemory()) {
            return new ByteArrayInputStream(out.getData());
        } else {
            return new TempFileInputStream(out.getFile());
        }
    }
View Full Code Here

Examples of org.apache.jackrabbit.vault.util.TempFileInputStream

        final long size;
        if (out.isInMemory()) {
            in = new ByteArrayInputStream(out.getData());
            size = out.getData().length;
        } else {
            in = new TempFileInputStream(out.getFile());
            size = out.getFile().length();
        }
        return new VaultInputSource() {

            @Override
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.