Package com.hp.hpl.jena.util

Examples of com.hp.hpl.jena.util.TypedStream


    }

    static void dwim(String url) throws Exception
    {
        log.info("URL = "+url) ;
        TypedStream typedStream = negotiateHTTP(url) ;
        log.info("MIME type:   "+typedStream.getMimeType()) ;
        log.info("Content type: "+typedStream.getCharset()) ;
        typedStream.getInput().close() ;
    }
View Full Code Here


            fn = filename.substring(x-3) ;
        }
       
        String suffix = FileUtils.getFilenameExt(fn) ;
        String mimeType = extToMimeType.get(suffix) ;
        return new TypedStream(in, mimeType, null) ;
    }
View Full Code Here

        }

        if ( contentType == null )
            contentType = contentTypeRDFXML ;
       
        return new TypedStream(stream, contentType, charset) ;
    }
View Full Code Here

      if (log.isDebugEnabled()) log.debug("FileManager.readModel() URI: {} Base URI: {}", mappedURI, filenameOrURI);

      return super.readModel(model, mappedURI, filenameOrURI, null); // let FileManager handle
  }

  TypedStream in = openNoMapOrNull(filenameOrURI);
  if (in != null)
  {
      if (log.isDebugEnabled()) log.debug("Opened filename or URI {} with TypedStream {}", filenameOrURI, in);

            Lang lang = RDFLanguages.contentTypeToLang(in.getMimeType());
      if (lang != null) // do not read if MimeType/syntax are not known
      {
                String syntax = lang.getName();
    if (log.isDebugEnabled()) log.debug("URI {} syntax is {}, reading it", filenameOrURI, syntax);

    model.read(in.getInput(), filenameOrURI, syntax) ;
    try { in.getInput().close(); } catch (IOException ex) {}
      }
      else
    if (log.isDebugEnabled()) log.debug("Syntax for URI {} unknown, ignoring", filenameOrURI);
  }
  else
View Full Code Here

  {
      if (log.isDebugEnabled()) log.debug("URI {} does not match UriTemplate {} of this GRDDL locator", filenameOrURI, getUriTemplate());
      return null;     
  }
 
  TypedStream ts = super.open(filenameOrURI);
  if (ts == null)
  {
      if (log.isDebugEnabled()) log.debug("Could not open HTTP stream from URI: {}", filenameOrURI);
      return null;
  }

  try
  {
      ByteArrayOutputStream bos = new ByteArrayOutputStream();

      getXSLTBuilder().document(new StreamSource(ts.getInput())).
    resolver(getURIResolver()).
    result(new StreamResult(bos)).
    parameter("uri", new URI(filenameOrURI)).
    transform();
     
      if (log.isTraceEnabled()) log.trace("GRDDL RDF/XML output: {}", bos.toString());

      return new TypedStream(new BufferedInputStream(new ByteArrayInputStream(bos.toByteArray())),
        Lang.RDFXML.getContentType().getContentType(),
        "UTF-8");
  }
  catch (TransformerException ex)
  {
View Full Code Here

      {
    if (log.isDebugEnabled()) log.debug("Returned content type {} is not acceptable - TypedStream will not be read", contentType);
    return null;
      }
   
            return new TypedStream(in, contentType, getCharset(c));
        }
        catch (java.io.FileNotFoundException ex)
        {
            if (log.isTraceEnabled())
    log.trace("LocatorLinkedData: not found: {}", filenameOrURI);
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.util.TypedStream

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.