Package java.io

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


 
  @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

 
  @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

      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

  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

  }

  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

    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

                             + 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

   * allow|deny mimetype/subtype <xxxx >yyyyy
   */
  public void loadRuleFile(String filename)
    throws IOException
  {
    InputStream is = new FileInputStream(filename);
    BufferedReader reader =
      new BufferedReader(new InputStreamReader(is));

    String line = "";
    int lineno=0;
View Full Code Here

      }
      int returnVal = m_FileChooser.showOpenDialog(this);
      if (returnVal == JFileChooser.APPROVE_OPTION) {
  File selected = m_FileChooser.getSelectedFile();
  try {
    ObjectInputStream oi = new ObjectInputStream(new BufferedInputStream(new FileInputStream(selected)));
    Object obj = oi.readObject();
    oi.close();
    if (!m_ClassType.isAssignableFrom(obj.getClass())) {
      throw new Exception("Object not of type: " + m_ClassType.getName());
    }
View Full Code Here

TOP

Related Classes of java.io.FileInputStream

Copyright © 2015 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.