Examples of FileContent


Examples of org.apache.commons.vfs2.FileContent

    public void testUnknownContent() throws Exception
    {

        // Try getting the content of an unknown file
        FileObject unknownFile = getReadFolder().resolveFile("unknown-file");
        FileContent content = unknownFile.getContent();
        try
        {
            content.getInputStream();
            fail();
        }
        catch (FileSystemException e)
        {
            assertSameMessage("vfs.provider/read-not-file.error", unknownFile, e);
        }
        try
        {
            content.getSize();
            fail();
        }
        catch (final FileSystemException e)
        {
            assertSameMessage("vfs.provider/get-size-not-file.error", unknownFile, e);
View Full Code Here

Examples of org.apache.commons.vfs2.FileContent

        if (file.exists())
        {
            final String newPrefix = prefix + INDENT;
            if (file.getType().hasContent())
            {
                final FileContent content = file.getContent();
                log(newPrefix + "Content-Length: " + content.getSize());
                log(newPrefix + "Last-Modified" + new Date(content.getLastModifiedTime()));
                if (showContent)
                {
                    log(newPrefix + "Content:");
                    logContent(file, newPrefix);
                }
View Full Code Here

Examples of org.apache.commons.vfs2.FileContent

     * Finds the provider to use to create a filesystem from a given file.
     */
    public String getScheme(final FileObject file) throws FileSystemException
    {
        // Check the file's mime type for a match
        final FileContent content = file.getContent();
        // final String mimeType = (String) content.getAttribute("content-type");
        final String mimeType = content.getContentInfo().getContentType();
        if (mimeType != null)
        {
            return mimeTypeMap.get(mimeType);
        }

View Full Code Here

Examples of org.apache.roller.weblogger.pojos.FileContent

        roller/testdata/roller-custom.properties */
        FileContentManager fmgr = WebloggerFactory.getWeblogger().getFileContentManager();

        // File should not exist initially
        try {
            FileContent fileContent = fmgr.getFileContent(testWeblog, "bookmarks-file-id");
            assertTrue("Non-existant file retrieved without any exception", false);
        } catch (FileNotFoundException e) {
            assertTrue("Exception thrown for non-existant file as expected", true);
        }

        // store a file
        InputStream is = getClass().getResourceAsStream("/bookmarks.opml");
        fmgr.saveFileContent(testWeblog, "bookmarks-file-id", is);

        // make sure file was stored successfully
        FileContent fileContent1 = fmgr.getFileContent(testWeblog, "bookmarks-file-id");
        assertEquals("bookmarks-file-id", fileContent1.getFileId());


        // delete file
        fmgr.deleteFile(testWeblog, "bookmarks-file-id");

        // File should not exist after delete
        try {
            FileContent fileContent = fmgr.getFileContent(testWeblog, "bookmarks-file-id");
            assertTrue("Non-existant file retrieved without any exception", false);
        } catch (FileNotFoundException e) {
            assertTrue("Exception thrown for non-existant file as expected", true);
        }

View Full Code Here

Examples of org.syncany.database.FileContent

   
    MultiChunkEntry newMultiChunkEntry = new MultiChunkEntry(MultiChunkId.parseMultiChunkId("1234567890987654321234567876543456555555"), 10);
    newMultiChunkEntry.addChunk(newChunkEntry.getChecksum());
    newDatabaseVersion.addMultiChunk(newMultiChunkEntry);
   
    FileContent newFileContent = new FileContent();
    newFileContent.setChecksum(FileChecksum.parseFileChecksum("aaaaaaaaaaaaaaaaaaaaab2b263ffa4cc48e282f"));
    newFileContent.setSize(1L);   
    newFileContent.addChunk(newChunkEntry.getChecksum());
    newDatabaseVersion.addFileContent(newFileContent);   
   
    // c. Persist database version
    databaseVersionDao.persistDatabaseVersion(newDatabaseVersion);
   
View Full Code Here

Examples of pt.webdetails.cpf.impl.FileContent

    if ( isPreview ) {
      return Utils.getSystemOrUserRWAccess( path ).saveFile( path, bais );

    } else {
      FileContent file = new FileContent();
      file.setPath( path );
      file.setContents( bais );
      file.setTitle( title );
      file.setDescription( description );

      return PentahoCdeEnvironment.getInstance().getContentAccessFactory().getUserContentAccess( null )
        .saveFile( file );

    }
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.