Examples of FileInputStream


Examples of java.io.FileInputStream

        {
            System.err.println( "usage: java org.pdfbox.cmapparser.CMapParser <CMAP File>" );
            System.exit( -1 );
        }
        CMapParser parser = new CMapParser(  );
        CMap result = parser.parse( new FileInputStream( args[0] ) );
        System.out.println( "Result:" + result );
    }
View Full Code Here

Examples of java.io.FileInputStream

        helpTestProcess("SELECT * FROM xmltest.doc9 WHERE OrderID='5' OR OrderID='2'", expectedDoc, metadata, dataMgr);         //$NON-NLS-1$
    }
   
    public static String readFile(String fileName) throws Exception {
        FileInputStream fis = new FileInputStream(UnitTestUtil.getTestDataFile(fileName));
       
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
       
        int c = 0;
        while ((c = fis.read()) != -1) {
            baos.write(c);
        }
       
        return baos.toString();
    }
View Full Code Here

Examples of java.io.FileInputStream

   
  @Test public void testXmlParseClob() throws Exception {
      String sql = "select xmlparse(document cast(? as clob)) x"; //$NON-NLS-1$
     
        List[] expected = new List[] {
            Arrays.asList(ObjectConverterUtil.convertToString(new FileInputStream(UnitTestUtil.getTestDataFile("udf.xmi")))),
        };   
   
        processPreparedStatement(sql, expected, dataManager, new DefaultCapabilitiesFinder(), FakeMetadataFactory.example1Cached(), Arrays.asList(TestTextTable.clobFromFile("udf.xmi")));
    }
View Full Code Here

Examples of java.io.FileInputStream

 
  @Test public void testXmlParseBlob() throws Exception {
      String sql = "select xmlparse(document cast(? as blob)) x"; //$NON-NLS-1$
     
        List[] expected = new List[] {
            Arrays.asList(ObjectConverterUtil.convertToString(new FileInputStream(UnitTestUtil.getTestDataFile("udf.xmi")))),
        };   
   
        processPreparedStatement(sql, expected, dataManager, new DefaultCapabilitiesFinder(), FakeMetadataFactory.example1Cached(), Arrays.asList(blobFromFile("udf.xmi")));
    }
View Full Code Here

Examples of java.io.FileInputStream

 
  @Test public void testXmlParseBlobWithEncoding() throws Exception {
      String sql = "select xmlparse(document cast(? as blob)) x"; //$NON-NLS-1$
     
        List[] expected = new List[] {
            Arrays.asList(ObjectConverterUtil.convertToString(new InputStreamReader(new FileInputStream(UnitTestUtil.getTestDataFile("encoding.xml")), Charset.forName("ISO-8859-1")))),
        };   
   
        processPreparedStatement(sql, expected, dataManager, new DefaultCapabilitiesFinder(), FakeMetadataFactory.example1Cached(), Arrays.asList(blobFromFile("encoding.xml")));
    }
View Full Code Here

Examples of java.io.FileInputStream

      log.trace("loadAttachment, attachmentsStore=" + attachmentsStore); //$NON-NLS-1$
    }

    ObjectInputStream ois = null;
    try {
      ois = new ObjectInputStream(new FileInputStream(attachmentsStore));
      return expected.cast(ois.readObject());
    } finally {
      if (ois != null) {
        ois.close();
      }
View Full Code Here

Examples of java.io.FileInputStream

  public static ResourceXmlBean getResourceXmlBean(
    HttpServlet servlet,
    String id)
    throws Exception {
    if (bean == null) {
      FileInputStream fis =
        new FileInputStream(
          new File(
            servlet.getServletContext().getRealPath(
              "../../../conf/resources.xml")));
      bean = ResourceXmlBean.parse(fis);
      fis.close();
    }
    return bean.getResource(id);
  }
View Full Code Here

Examples of java.io.FileInputStream

  }

  public static Vector getResourceXmlBeans(HttpServlet servlet)
    throws Exception {
    if (bean == null) {
      FileInputStream fis =
        new FileInputStream(
          new File(
            servlet.getServletContext().getRealPath(
              "../../../conf/resources.xml")));
      bean = ResourceXmlBean.parse(fis);
      fis.close();
    }
    return bean.getItems();
  }
View Full Code Here

Examples of java.io.FileInputStream

    byte[] buff = new byte[(int) size];

    // read the file
    try {
      FileInputStream fi = new FileInputStream(cacheFile);
      fi.read(buff);
    } catch (IOException e) {
      log.info("Could not read cached document "+e.getMessage());
      return null;
    }
   
View Full Code Here

Examples of java.io.FileInputStream

                             + File.separator
                             + resourceName);

    if (propFile.exists()) {
      try {
        userProps.load(new FileInputStream(propFile));
      } catch (Exception ex) {
        throw new Exception("Problem reading user properties: " + propFile);
      }
    }

    // Allow a properties file in the current directory to override
    Properties localProps = new Properties(userProps);
    propFile = new File(resourceName);
    if (propFile.exists()) {
      try {
        localProps.load(new FileInputStream(propFile));
      } catch (Exception ex) {
        throw new Exception("Problem reading local properties: " + propFile);
      }
    }
   
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.