Examples of FileEntry


Examples of ca.pgon.saviorlib.FileSystems.FileEntry

        int posSource = 0, posDestination = 0;
        while ((posSource < sourceList.size()) && (posDestination < destinationList.size())) {
            stopIfNeeded();
            pauseIfNeeded();
           
            FileEntry source = sourceList.get(posSource);
            FileEntry destination = destinationList.get(posDestination);
           
            switch (source.compareTo(destination)) {
                case -1:
                    processAdd(source);
                    ++posSource;
View Full Code Here

Examples of ch.enterag.utils.zip.FileEntry

      log.info("[createZip] Normalizing paths...");
      List<String> normalizedPaths = normalizePaths(srcFolder);
     
      for(int i=0;i<normalizedPaths.size();i++) {
        String currentZipEntryPath = normalizedPaths.get(i);
        FileEntry entry = new FileEntry(currentZipEntryPath);
        File currentFile = new File(listOfFiles.get(i));
       
        writeEntry(zipFile, entry, currentFile, compress);
      }
      log.info("[createZip] All Files written to zip file: " + zipFile.getDiskFile().getFileName());
View Full Code Here

Examples of com.github.stephenc.javaisotools.udflib.structures.FileEntry

                                          int blockSize, int serialNumberForTags,
                                          UDFImageBuilderFile currentUDFImageBuilderFile, long currentBlock,
                                          FileEntry parentFileEntry, long uniqueID, boolean writeExtendedFileEntries,
                                          int descriptorVersion)
            throws Exception {
        FileEntry myFileEntry = null;

        if (!writeExtendedFileEntries) {
            myFileEntry = new FileEntry();
        } else {
            myFileEntry = new ExtendedFileEntry();
        }

        myFileEntry.DescriptorTag.TagSerialNumber = serialNumberForTags;
        myFileEntry.DescriptorTag.DescriptorVersion = descriptorVersion;
        myFileEntry.DescriptorTag.TagLocation = currentBlock - partitionStartingBlock;

        myFileEntry.Uid = 0xFFFFFFFF;    // TODO: get current uid and gid if java supports it
        myFileEntry.Gid = 0xFFFFFFFF;

        // TODO: get real file permission if java supports it
        myFileEntry.Permissions = Permissions.OTHER_Read | Permissions.GROUP_Read | Permissions.OWNER_Read;

        myFileEntry.FileLinkCount = currentUDFImageBuilderFile.getFileLinkCount();

        myFileEntry.RecordFormat = 0;
        myFileEntry.RecordDisplayAttributes = 0;
        myFileEntry.RecordLength = 0;

        myFileEntry.AccessTime = new Timestamp(currentUDFImageBuilderFile.getAccessTime());
        myFileEntry.ModificationTime = new Timestamp(currentUDFImageBuilderFile.getModificationTime());
        myFileEntry.AttributeTime = new Timestamp(currentUDFImageBuilderFile.getAttributeTime());

        myFileEntry.Checkpoint = 1;

        myFileEntry.ImplementationIdentifier.setIdentifier(applicationIdentifier);
        myFileEntry.ImplementationIdentifier.IdentifierSuffix = applicationIdentifierSuffix;

        myFileEntry.ICBTag.PriorRecordedNumberofDirectEntries = 0;
        myFileEntry.ICBTag.NumberofEntries = 1;
        myFileEntry.ICBTag.StrategyType = 4;

        myFileEntry.UniqueID = uniqueID;

        long nextFreeBlock = currentBlock + 1;

        /*
           *  if file is a directory
           */
        if (currentUDFImageBuilderFile.getFileType() == UDFImageBuilderFile.FileType.Directory) {
            myFileEntry.ICBTag.FileType = 4;    // directory

            myFileEntry.Permissions |=
                    Permissions.OTHER_Execute | Permissions.GROUP_Execute | Permissions.OWNER_Execute;

            // create file identifier descriptors for all child files
            UDFImageBuilderFile childUDFImageBuilderFiles[] = currentUDFImageBuilderFile.getChilds();

            ArrayList<FileIdentifierDescriptor> childFileIdentifierDescriptors =
                    new ArrayList<FileIdentifierDescriptor>();

            // parent directory FID
            FileIdentifierDescriptor parentDirectoryFileIdentifierDescriptor = new FileIdentifierDescriptor();

            parentDirectoryFileIdentifierDescriptor.DescriptorTag.TagLocation = currentBlock - partitionStartingBlock;
            parentDirectoryFileIdentifierDescriptor.DescriptorTag.TagSerialNumber = serialNumberForTags;
            parentDirectoryFileIdentifierDescriptor.DescriptorTag.DescriptorVersion = descriptorVersion;

            parentDirectoryFileIdentifierDescriptor.ICB.ExtentLength = blockSize;
            parentDirectoryFileIdentifierDescriptor.ICB.ExtentLocation.part_num = 0;

            parentDirectoryFileIdentifierDescriptor.FileVersionNumber = 1;
            parentDirectoryFileIdentifierDescriptor.FileCharacteristics = 10; // file is directory and parent

            // if root directory
            if (parentFileEntry == null) {
                parentDirectoryFileIdentifierDescriptor.ICB.ExtentLocation.lb_num =
                        currentBlock - partitionStartingBlock;
            }
            // if non root directory
            else {
                parentDirectoryFileIdentifierDescriptor.ICB.ExtentLocation.lb_num =
                        parentFileEntry.DescriptorTag.TagLocation;

                parentDirectoryFileIdentifierDescriptor.ICB.implementationUse = new byte[6];
                parentDirectoryFileIdentifierDescriptor.ICB.implementationUse[2] =
                        (byte) (parentFileEntry.UniqueID & 0xFF);
                parentDirectoryFileIdentifierDescriptor.ICB.implementationUse[3] =
                        (byte) ((parentFileEntry.UniqueID >> 8) & 0xFF);
                parentDirectoryFileIdentifierDescriptor.ICB.implementationUse[4] =
                        (byte) ((parentFileEntry.UniqueID >> 16) & 0xFF);
                parentDirectoryFileIdentifierDescriptor.ICB.implementationUse[5] =
                        (byte) ((parentFileEntry.UniqueID >> 32) & 0xFF);
            }

            childFileIdentifierDescriptors.add(parentDirectoryFileIdentifierDescriptor);

            // child file FIDs
            for (int i = 0; i < childUDFImageBuilderFiles.length; ++i) {
                long childFileUniqueID = myUniqueIdDisposer.getNextUniqueId();

                FileIdentifierDescriptor childFileIdentifierDescriptor = new FileIdentifierDescriptor();

                childFileIdentifierDescriptor.DescriptorTag.TagLocation = currentBlock - partitionStartingBlock;
                childFileIdentifierDescriptor.DescriptorTag.TagSerialNumber = serialNumberForTags;
                childFileIdentifierDescriptor.DescriptorTag.DescriptorVersion = descriptorVersion;

                childFileIdentifierDescriptor.ICB.ExtentLength = blockSize;
                childFileIdentifierDescriptor.ICB.ExtentLocation.lb_num = nextFreeBlock - partitionStartingBlock;
                childFileIdentifierDescriptor.ICB.ExtentLocation.part_num = 0;

                childFileIdentifierDescriptor.ICB.implementationUse = new byte[6];
                childFileIdentifierDescriptor.ICB.implementationUse[2] = (byte) (childFileUniqueID & 0xFF);
                childFileIdentifierDescriptor.ICB.implementationUse[3] = (byte) ((childFileUniqueID >> 8) & 0xFF);
                childFileIdentifierDescriptor.ICB.implementationUse[4] = (byte) ((childFileUniqueID >> 16) & 0xFF);
                childFileIdentifierDescriptor.ICB.implementationUse[5] = (byte) ((childFileUniqueID >> 32) & 0xFF);

                childFileIdentifierDescriptor.FileVersionNumber = 1;

                childFileIdentifierDescriptor.setFileIdentifier(childUDFImageBuilderFiles[i].getIdentifier());

                if (childUDFImageBuilderFiles[i].getFileType() == UDFImageBuilderFile.FileType.Directory) {
                    childFileIdentifierDescriptor.FileCharacteristics = 2;
                }

                childFileIdentifierDescriptors.add(childFileIdentifierDescriptor);

                nextFreeBlock = recursiveWriteFilesystem(myRandomAccessFile, partitionStartingBlock, blockSize,
                        serialNumberForTags, childUDFImageBuilderFiles[i], nextFreeBlock, myFileEntry,
                        childFileUniqueID, writeExtendedFileEntries, descriptorVersion);
            }

            // get directory file data length
            int directoryFileDataLength = 0;
            for (int i = 0; i < childFileIdentifierDescriptors.size(); ++i) {
                directoryFileDataLength += childFileIdentifierDescriptors.get(i).getLength();
            }

            myFileEntry.InformationLength = directoryFileDataLength;

            if ((writeExtendedFileEntries && directoryFileDataLength <= blockSize - ExtendedFileEntry.fixedPartLength)
                    ||
                    (!writeExtendedFileEntries && directoryFileDataLength <= blockSize - FileEntry.fixedPartLength)) {
                // inline embedded file data
                myFileEntry.ICBTag.Flags = 3;        // storage type inline
                myFileEntry.LogicalBlocksRecorded = 0;
                myFileEntry.LengthofAllocationDescriptors = directoryFileDataLength;
                myFileEntry.AllocationDescriptors = new byte[directoryFileDataLength];

                int pos = 0;
                for (int i = 0; i < childFileIdentifierDescriptors.size(); ++i) {
                    byte childFileIdentifierDescriptorBytes[] = childFileIdentifierDescriptors.get(i).getBytes();

                    System.arraycopy(childFileIdentifierDescriptorBytes, 0, myFileEntry.AllocationDescriptors, pos,
                            childFileIdentifierDescriptorBytes.length);
                    pos += childFileIdentifierDescriptorBytes.length;
                }
            } else {
                // store as exernal file data with Short_ad
                myFileEntry.ICBTag.Flags = 0;        // storage type short_ad

                myFileEntry.LogicalBlocksRecorded = (long) (directoryFileDataLength / blockSize);
                if (directoryFileDataLength % blockSize != 0) {
                    myFileEntry.LogicalBlocksRecorded++;
                }

                Short_ad allocationDescriptor = new Short_ad();

                allocationDescriptor.ExtentLength = directoryFileDataLength;
                allocationDescriptor.ExtentPosition = nextFreeBlock - partitionStartingBlock;

                long currentRealPosition = nextFreeBlock * blockSize;
                myRandomAccessFile.seek(currentRealPosition);

                for (int i = 0; i < childFileIdentifierDescriptors.size(); ++i) {
                    long tagLocationBlock = (long) (currentRealPosition / blockSize) - partitionStartingBlock;

                    FileIdentifierDescriptor childFileIdentifierDescriptor = childFileIdentifierDescriptors.get(i);

                    childFileIdentifierDescriptor.DescriptorTag.TagLocation = tagLocationBlock;

                    byte childFileIdentifierDescriptorBytes[] = childFileIdentifierDescriptors.get(i).getBytes();
                    myRandomAccessFile.write(childFileIdentifierDescriptorBytes);

                    currentRealPosition += childFileIdentifierDescriptorBytes.length;
                }

                nextFreeBlock += myFileEntry.LogicalBlocksRecorded;

                myFileEntry.AllocationDescriptors = allocationDescriptor.getBytes();
                myFileEntry.LengthofAllocationDescriptors = myFileEntry.AllocationDescriptors.length;
            }
        }

        /*
           *  if file is a "normal" file
           */
        else if (currentUDFImageBuilderFile.getFileType() == UDFImageBuilderFile.FileType.File) {
            myFileEntry.ICBTag.FileType = 5;    // normal file

            long fileSize = currentUDFImageBuilderFile.getFileLength();

            myFileEntry.InformationLength = fileSize;

            if ((writeExtendedFileEntries && fileSize <= (blockSize - ExtendedFileEntry.fixedPartLength))
                    || (!writeExtendedFileEntries && fileSize <= (blockSize - FileEntry.fixedPartLength))) {
                // store as inline embedded file data
                myFileEntry.ICBTag.Flags = 3;        // storage type inline
                myFileEntry.LogicalBlocksRecorded = 0;
                myFileEntry.LengthofAllocationDescriptors = fileSize;
                myFileEntry.AllocationDescriptors = new byte[(int) fileSize];
                currentUDFImageBuilderFile.readFileData(myFileEntry.AllocationDescriptors);
            } else {
                // store as exernal file data with Long_ad
                myFileEntry.ICBTag.Flags = 1;        // storage type long_ad

                myFileEntry.LogicalBlocksRecorded = (long) (fileSize / blockSize);
                if (fileSize % blockSize != 0) {
                    myFileEntry.LogicalBlocksRecorded++;
                }

                ArrayList<Long_ad> allocationDescriptors = new ArrayList<Long_ad>();

                long restFileSize = fileSize;
                long currentExtentPosition = nextFreeBlock - partitionStartingBlock;

                while (restFileSize > 0) {
                    Long_ad allocationDescriptor = new Long_ad();

                    if (restFileSize < maximumAllocationLength) {
                        allocationDescriptor.ExtentLength = restFileSize;
                    } else {
                        allocationDescriptor.ExtentLength = maximumAllocationLength;
                    }

                    allocationDescriptor.ExtentLocation.part_num = 0;
                    allocationDescriptor.ExtentLocation.lb_num = currentExtentPosition;

                    allocationDescriptors.add(allocationDescriptor);

                    restFileSize -= maximumAllocationLength;

                    currentExtentPosition += (maximumAllocationLength / blockSize);
                    if (maximumAllocationLength % blockSize != 0) {
                        currentExtentPosition++;
                    }
                }

                byte allocationDescriptorBytes[] = new byte[allocationDescriptors.size() * 16];

                int allocationDescriptorBytesPosition = 0;

                for (int i = 0; i < allocationDescriptors.size(); ++i) {
                    byte singleAllocationDescriptorBytes[] = allocationDescriptors.get(i).getBytes();
                    System.arraycopy(singleAllocationDescriptorBytes, 0, allocationDescriptorBytes,
                            allocationDescriptorBytesPosition, singleAllocationDescriptorBytes.length);
                    allocationDescriptorBytesPosition += singleAllocationDescriptorBytes.length;
                }

                myRandomAccessFile.seek(nextFreeBlock * blockSize);
                writeFileData(myRandomAccessFile, currentUDFImageBuilderFile.getSourceFile());

                nextFreeBlock += myFileEntry.LogicalBlocksRecorded;

                myFileEntry.AllocationDescriptors = allocationDescriptorBytes;
                myFileEntry.LengthofAllocationDescriptors = allocationDescriptorBytes.length;
            }

        }

        if (writeExtendedFileEntries) {
            ExtendedFileEntry myExtendedFileEntry = (ExtendedFileEntry) myFileEntry;
            myExtendedFileEntry.ObjectSize = myFileEntry.InformationLength;
            myExtendedFileEntry.CreationTime = new Timestamp(currentUDFImageBuilderFile.getCreationTime());
        }

        myRandomAccessFile.seek(currentBlock * blockSize);
        myFileEntry.write(myRandomAccessFile, blockSize);

        return nextFreeBlock;
    }
View Full Code Here

Examples of com.gwtmobile.phonegap.client.FileMgr.FileEntry

          public void onSuccess(Entry entry) {
            DirectoryEntry dir = (DirectoryEntry) entry;
            dir.getFile(fileName, new FileOptions().create(true), new EntryCallback() {
              @Override
              public void onSuccess(Entry entry) {
                FileEntry file = (FileEntry) entry;
                callback.onSuccess(file);
              }
              @Override
              public void onError(FileError error) {
                console("error:" + error.getCode());
View Full Code Here

Examples of com.ibm.xsp.extlib.sbt.files.FileEntry

        ArrayList<FileEntry> entries = new ArrayList<FileEntry>();
        String epName = accessor.findEndpointName();
        JsonNavigator navigator = new JsonNavigator(jsonObject);
        DataNavigator contentsNav = navigator.get("contents");
        for (int i = 0; i < contentsNav.getCount(); ++i) {
            FileEntry entry = new FileEntry();
            DataNavigator nav = contentsNav.get(i);
            try {
                String title = nav.stringValue("path");
                String[] result = title.split("/");
                entry.setTitle(result[result.length - 1]);
                entry.setUpdated(nav.dateValue("modified"));
                entry.setBytes(nav.intValue("bytes"));
                entry.setSize(nav.stringValue("size"));
                entry.setAuthorName(params.get("subscriberId"));
                entry.setVersion(String.valueOf( nav.doubleValue("revision")));
                boolean isDir = nav.booleanValue("is_dir");
                entry.setIsDirectory(isDir);
                if(!isDir){
                    entry.setMimeType(nav.stringValue("mime_type"));
                }
                else{
                    entry.setMimeType("undefined");
                }
                entry.setIcon(MimeIconRegistry.getInstance().get(entry.getMimeType()));
                entry.setPath(nav.stringValue("path"));
                String proxyUrl = "xsp/.proxy/files/" + title + "?" + PARAM_TYPE + "=" + TYPE + "&path=" + entry.getPath() + "&mimeType=" + entry.getMimeType() + "&" + PARAM_ENDPOINT_NAME + "=";
                if(StringUtil.isNotEmpty(epName)){
                    proxyUrl = proxyUrl + epName;
                }
                else{
                    proxyUrl = proxyUrl + TYPE;
                }
                entry.setProxyURL(proxyUrl);
                entry.setUniqueId(entry.getPath());
            } catch (Exception e) {
                throw new FacesExceptionEx(e);
            }
            entries.add(entry);
        }
View Full Code Here

Examples of com.ibm.xsp.extlib.sbt.files.FileEntry

    public void deleteRow(FileServiceAccessor accessor, Endpoint endpoint, String rowId) {
        // /basic/api/myuserlibrary/document/{document-id}/entry
        int rows = accessor.getCount();
        String rep = null;
        for (int i = 0; i < rows; i++) {
            FileEntry entry = (FileEntry) accessor.get(i);
            if (StringUtil.equals(rowId, entry.getUniqueId())) {
                rep = entry.getRepository();
                break;
            }
        }
        if (StringUtil.isEmpty(rep)) {
            return;
View Full Code Here

Examples of com.ibm.xsp.extlib.sbt.files.FileEntry

                        }
                        if (entries != null) {
                            String epName = accessor.findEndpointName();
                            for (int i = 0; i < entries.getCount(); i++) {
                                DataNavigator navigator = entries.get(i);
                                FileEntry fe = new FileEntry();
                                fe.setRepository(repId);
                                fe.setTitle(navigator.stringValue(TAG_LABEL));
                                fe.setUpdated(navigator.dateValue(TAG_MODIFIED));
                                fe.setAuthorName(navigator.stringValue(TAG_AUTHOR + "/" + TAG_NAME));
                                fe.setDescription(navigator.stringValue(TAG_SUMMARY));
                                fe.setFileId(navigator.stringValue(TAG_UUID));
                                fe.setUniqueId(fe.getFileId());
                                fe.setMimeType(getMimeType(navigator.stringValue(TAG_LABEL)));
                                fe.setIcon(MimeIconRegistry.getInstance().get(fe.getMimeType()));
                                String proxyUrl = "xsp/.proxy/files/"+accessor.findEndpointName()+"/connections/" + fe.getTitle() + "?" + PARAM_TYPE + "=" + TYPE + "&" + PARAM_ID
                                        + "=" + fe.getUniqueId() + "&" + PARAM_REPOSITORY_ID + "=" + repId + "&"+"fileName="+fe.getTitle()+"&" + PARAM_ENDPOINT_NAME
                                        + "=";
                                if (StringUtil.isNotEmpty(epName)) {
                                    proxyUrl = proxyUrl + epName;
                                }
                                else {
                                    proxyUrl = proxyUrl + TYPE;
                                }
                                fe.setProxyURL(proxyUrl);

                                fe.setPublished(navigator.dateValue(TAG_PUBLISHED));
                                fe.setVersion(navigator.stringValue(TAG_VERSION));
                                fe.setVisibility(navigator.stringValue(TAG_VISIBILITY));
                                fileEntries.add(fe);
                            }
                        }
                    }
                }
View Full Code Here

Examples of com.ibm.xsp.extlib.sbt.files.FileEntry

        DataNavigator mynav = navigator.get("feed/entry");

        if (mynav != null) {
            String epName = accessor.findEndpointName();
            for (int i = 0; i < mynav.getCount(); i++) {
                FileEntry entry = new FileEntry();
                DataNavigator nav = mynav.get(i);
                entry.setUserId((String) UserBean.get().getPerson().getField(LOTUS_LIVE_SUBSCRIBER_ID));
                entry.setTitle(nav.stringValue("title"));
                entry.setUpdated(nav.dateValue("updated"));
                entry.setPublished(nav.dateValue("published"));
                entry.setAuthorName(nav.stringValue("author/name"));
               
                String id = nav.stringValue("id");
                if (StringUtil.isNotEmpty(id)) {
                    int index = id.indexOf("snx:file!");
                    if (index != -1) {
                        index = index + "snx:file!".length();
                        id = id.substring(index);
                    }
                }
                //hack
                id=id.replace("http://www.ibm.com/xmlns/prod/sn/cmis/00000000-0000-0000-0001-000000000000!", "");
                entry.setFileId(id);
                entry.setUniqueId(id);
                DataNavigator propsNavigator = nav.get("object/properties");

                String description = propsNavigator.get("propertyString").selectEq("@displayName", "Description").stringValue("value");
                entry.setDescription(StringUtil.getNonNullString(description));
                String size = propsNavigator.get("propertyInteger").selectEq("@propertyDefinitionId", "cmis:contentStreamLength").stringValue("value");
                entry.setSize(calculateBytes(size));
                String version = propsNavigator.get("propertyString").selectEq("@propertyDefinitionId", "cmis:versionLabel").stringValue("value");
                entry.setVersion(StringUtil.getNonNullString(version));
                String visibility = propsNavigator.get("propertyString").selectEq("@propertyDefinitionId", "snx:visibilityComputed").stringValue("value");
                entry.setVisibility(StringUtil.getNonNullString(visibility));
                String mimeType = propsNavigator.get("propertyString").selectEq("@propertyDefinitionId", "cmis:contentStreamMimeType").stringValue("value");
                entry.setMimeType(mimeType);
                entry.setIcon(MimeIconRegistry.getInstance().get(mimeType));
               
                String proxyUrl = "xsp/.proxy/files/" + entry.getTitle() + "?" + PARAM_TYPE + "=" + TYPE + "&" + PARAM_ID + "="
                        + entry.getFileId() + "&" + PARAM_REPOSITORY_ID + "=" + composeRepositoryID(entry) + "&"+"fileName="+entry.getTitle()+ "&" + PARAM_ENDPOINT_NAME
                        + "=";
               
                if (StringUtil.isNotEmpty(epName)) {
                    proxyUrl = proxyUrl + epName;
                }
                else {
                    proxyUrl = proxyUrl + TYPE;
                }
                entry.setProxyURL(proxyUrl);
                entries.add(entry);
            }
        }
        return entries;
    }
View Full Code Here

Examples of com.jeecms.common.util.Zipper.FileEntry

    response.setContentType("application/x-download;charset=UTF-8");
    response.addHeader("Content-disposition", "filename="
        + backName+".zip");
    for(String filename:names){
      File file=new File(realPathResolver.get(filename));
      fileEntrys.add(new FileEntry("", "", file));
    }
    try {
      // 模板一般都在windows下编辑,所以默认编码为GBK
      Zipper.zip(response.getOutputStream(), fileEntrys, "GBK");
    } catch (IOException e) {
View Full Code Here

Examples of com.jeecms.common.util.Zipper.FileEntry

  }

  public List<FileEntry> export(CmsSite site, String solution) {
    List<FileEntry> fileEntrys = new ArrayList<FileEntry>();
    File tpl = new File(realPathResolver.get(site.getTplPath()), solution);
    fileEntrys.add(new FileEntry("", "", tpl));
    File res = new File(realPathResolver.get(site.getResPath()), solution);
    if (res.exists()) {
      for (File r : res.listFiles()) {
        fileEntrys.add(new FileEntry(FrontUtils.RES_EXP, r));
      }
    }
    return fileEntrys;
  }
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.