Package com.caucho.vfs

Examples of com.caucho.vfs.ReadStream


   * @param source A string containing the HTML
   */
  // XXX: also can be called statically, returns a DOMDocument in that case
  public boolean loadHTML(Env env, String source)
  {
    ReadStream is = StringStream.open(source);

    try {
      getImpl().parseHTMLDocument(_delegate, is, null);

      _delegate.setXmlStandalone(true);

      /**
       * XXX:
       _delegate.setDoctype(new QDocumentType("html",
       "-//W3C//DTD HTML 4.0 Transitional//EN",
       "http://www.w3.org/TR/REC-html40/loose.dtd"));
       */
    }
    catch (SAXException ex) {
      env.warning(ex);
      return false;
    }
    catch (IOException ex) {
      env.warning(ex);
      return false;
    }
    finally {
      if (is != null) {
        is.close();
      }
    }

    return true;
  }
View Full Code Here


  }

  // XXX: also can be called statically, returns a DOMDocument in that case
  public boolean loadHTMLFile(Env env, Path path)
  {
    ReadStream is = null;

    try {
      is = path.openRead();

      getImpl().parseHTMLDocument(_delegate, is, path.getPath());

      _delegate.setXmlStandalone(true);
      /**
       * XXX:
       _delegate.setDoctype(new QDocumentType("html",
       "-//W3C//DTD HTML 4.0 Transitional//EN",
       "http://www.w3.org/TR/REC-html40/loose.dtd"));
       */
    }
    catch (SAXException ex) {
      env.warning(ex);
      return false;
    }
    catch (IOException ex) {
      env.warning(ex);
      return false;
    }
    finally {
      if (is != null) {
        is.close();
      }
    }

    return true;
  }
View Full Code Here

  {
    if (options != null)
      env.stub(L.l("loadXML 'options' is ignored"));

    InputStream is = source.toInputStream();
    ReadStream in = null;

    try {
      in = Vfs.openRead(is);

      getImpl().parseXMLDocument(_delegate, in, null);
View Full Code Here

      // XXX: issues with _jpegHead vs ts.openReadAndSaveBuffer()
      _jpegHead = ts.getHead();
      is.close();

      _is = new ReadStream();
      ts.openRead(_is);

      parseJPEG();

      return true;
View Full Code Here

    HashMap<String,Long> lengthMap = new HashMap<String,Long>();

    fillLengthMap(lengthMap, path);

    ReadStream is = path.openRead();

    fillCommit(lengthMap, is);

    _commit.commit();
  }
View Full Code Here

  }

  private void fillLengthMap(HashMap<String,Long> lengthMap, Path jar)
    throws IOException
  {
    ReadStream is = jar.openRead();
    ZipInputStream zin = null;
   
    try {
      zin = new ZipInputStream(is);
View Full Code Here

  {
    InputStream is = null;

    try {
      ZipStreamImpl zipIs = _jar.getJar().openReadImpl(path);
      is = new ReadStream(zipIs);
   
      long length = 0;

      while (is.read() >= 0) {
        length++;
View Full Code Here

      if (size < 0)
        size = getLength(path);
     
      ZipStreamImpl zipIs = _jar.getJar().openReadImpl(path);
     
      ReadStream is = new ReadStream(zipIs);
     
      try {
        return GitCommitTree.writeBlob(is, size);
      } finally {
        is.close();
       
        zipIs.close();
      }
    }
  }
View Full Code Here

      if (taglib != null && ! taglib.isModified())
        return taglib;
    }

    ReadStream is = path.openRead();

    try {
      taglib = parseTld(is);

      if (path instanceof JarPath)
        taglib.setJarPath(path.lookup("/"));

      _tldMap.put(path, new SoftReference<TldTaglib>(taglib));

      return taglib;
    } finally {
      is.close();
    }
  }
View Full Code Here

   * @param path location of the taglib
   */
  private TldPreload parseTldPreload(Path path)
    throws JspParseException, IOException
  {
    ReadStream is = path.openRead();

    try {
      TldPreload taglib = parseTldPreload(is);

      taglib.setPath(path);
      String appDir = _webApp.getRootDirectory().getPath();
      String tagPath = path.getPath();

      if (tagPath.startsWith(appDir))
        taglib.setLocation(tagPath.substring(appDir.length()));

      return taglib;
    } finally {
      is.close();
    }
  }
View Full Code Here

TOP

Related Classes of com.caucho.vfs.ReadStream

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.