Package flex2.compiler.io

Examples of flex2.compiler.io.InMemoryFile


  public Source copy()
  {
    if (unit != null && unit.isDone())
    {
      // copying Source
      VirtualFile f = new InMemoryFile(unit.getByteCodes(), getName(), MimeMappings.ABC, fileTime);
      Source s = new Source(f, pathRoot, relativePath, shortName, owner, isInternal, isRoot, isDebuggable);

      s.fileIncludeTimes.putAll(fileIncludeTimes);
      s.logger = logger;
View Full Code Here


   */
  static Source newSource(byte[] abc, String name, long fileTime, VirtualFile pathRoot, String relativePath, String shortName, Object owner,
              boolean isInternal, boolean isRoot, boolean isDebuggable, Set<VirtualFile> includes, Map<VirtualFile, Long> includeTimes,
              LocalLogger logger)
  {
    VirtualFile f = new InMemoryFile(abc, name, MimeMappings.ABC, fileTime);
    return newSource(f, fileTime, pathRoot, relativePath, shortName, owner, isInternal, isRoot, isDebuggable,
                     includes, includeTimes, logger);
  }
View Full Code Here

            VirtualFile f = (VirtualFile)entry.getValue();
            if (swc.getArchive().getFile( fileName ) == null)   // icons were already added, don't overwrite
            {
                try
                {
                    VirtualFile swcFile = new InMemoryFile(f.getInputStream(), fileName,
                                                           f.getMimeType(), f.getLastModified());
                    swc.addFile(swcFile);
                }
                catch (IOException ioException)
                {
View Full Code Here

        files.put( file.getName(), file );
    }

    public void putFile( String path, byte[] data, long lastModified )
    {
        InMemoryFile file = new InMemoryFile( data, path, MimeMappings.getMimeType(path), lastModified );
        files.put( file.getName(), file );
    }
View Full Code Here

    }
   
    private Source createSource(SwcScript script)
    {
        String loc = script.getLibrary().getSwcLocation();
        InMemoryFile f = new InMemoryFile( script.getABC(), script.toString(), MimeMappings.ABC, script.getLastModified() );

      // FIXME: C: I tried to set playerglobal.swc as an externally lib, but FlexMovie seems to allow externs on the last frame??
      Source s = (loc.endsWith(StandardDefs.SWC_PLAYERGLOBAL) ||
          loc.endsWith(StandardDefs.SWC_AIRGLOBAL) ||
          loc.endsWith(StandardDefs.SWC_AVMPLUS)) ?
View Full Code Here

        swfOut.close();

        String libPath = libname + ".swf";

        SwcLibrary lib = new SwcLibrary( this, libPath );
        VirtualFile swfFile = new InMemoryFile(swf, libPath,
                                               MimeMappings.getMimeType(libPath), new Date().getTime());
        archive.putFile( swfFile );
        libraries.put( libPath, lib );

        // check if we should compute the digest.
View Full Code Here

                        {
                            iconFile = (((SwcScript) source.getOwner()).getLibrary().getSwc().getFile(swcIcon));
                            if (iconFile != null)
                            {
                                // we then put the resolved file into an InMemoryFile so that we can changed its name
                                VirtualFile inMemFile = new InMemoryFile(iconFile.getInputStream(), swcIcon,
                                                                         MimeMappings.getMimeType(swcIcon),
                                                                         iconFile.getLastModified());
                                archive.putFile( inMemFile );
                                return;
                            }
                        }
                    }
                }

                // It seems like this will never be true, because if
                // the icon was missing when the original SWC was
                // created, a MissingIconFile would have been thrown.
                if (iconFile == null)
                {
                    return;
                }
            }

            if (iconFile == null)
            {
                throw new SwcException.MissingIconFile(unit.icon, sourceName);
            }

            // yes using both toDot and toColon here feels very wacky
            String workingSourceName = NameFormatter.toColon(NameFormatter.toDot(sourceName, '/'));
            SwcComponent comp = components.get(workingSourceName);
            String rel = source.getRelativePath();
            String iconName = (rel == null || rel.length() == 0) ? unit.icon : rel + "/" + unit.icon;
            if (comp != null)
            {
                comp.setIcon(iconName);
            }

            // we then put the resolved file into an InMemoryFile so that we can changed its name
            VirtualFile inMemFile = new InMemoryFile(iconFile.getInputStream(), iconName,
                                                     MimeMappings.getMimeType(iconName),
                                                     iconFile.getLastModified());
            archive.putFile( inMemFile );
        }
    }
View Full Code Here

          Enumeration e = zipFile.getEntries();
          while (e.hasMoreElements())
          {
            ZipEntry ze = (ZipEntry)e.nextElement();
                InputStream inputStream = zipFile.getInputStream(ze);
                VirtualFile f = new InMemoryFile( inputStream, ze.getSize(), path + "$" + ze.getName(),
                    MimeMappings.getMimeType(ze.getName()), ze.getTime() );
                files.put( ze.getName(), f );
            }
        }
        catch (SwcException.UnknownZipFormat e)
View Full Code Here

        if (files == null)
        {
            files = new HashMap<String, VirtualFile>();
        }

        InMemoryFile file = new InMemoryFile( data, path, MimeMappings.getMimeType(path), lastModified );
       
        files.put( file.getName(), file );
    }
View Full Code Here

        // it's not in the HashMap. let's locate it in the file system.
        File absolute = FileUtil.openFile(name);
        if (absolute != null && absolute.exists())
        {
            return new LocalFile(absolute);
        }
       
        File relative = FileUtil.openFile(fullName);
        if (relative != null && relative.exists())
        {
            return new LocalFile(relative);
        }
       
        return null;
    }
View Full Code Here

TOP

Related Classes of flex2.compiler.io.InMemoryFile

Copyright © 2018 www.massapicom. 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.