Package java.io

Examples of java.io.FileInputStream


                 
          p.load( fis );
         
          fis.close();
         
          scratch_file_is = new FileInputStream( scratch_file_name );
         
          messages = new LightHashMap();
         
          messages.putAll( p );
         
View Full Code Here


        FTPTransferType currentTransferType = chooseTransferMode(remoteFile);

        try {
            InputStream srcStream = null;
            if (retryCount == 0 || append) {
                srcStream = new FileInputStream(localPath);
                remoteFile = putStream(srcStream, remoteFile, append);
            } else {
                for (int attempt = 1;; attempt++) {
                    try {
                        if (attempt > 1
                                && getType().equals(FTPTransferType.BINARY))
                            resume();
                        log.debug("Attempt #" + attempt);
                        srcStream = new FileInputStream(localPath);
                        remoteFile = putStream(srcStream, remoteFile, append);
                        break;
                    } catch (ControlChannelIOException ex) {
                        if (!processControlChannelException(cwd, ex, attempt))
                            throw ex;
View Full Code Here

    private static Sequence<? extends Item> doQuery(String queryFile) throws FileNotFoundException,
            XQueryException {
        XQueryModule xqmod = new XQueryModule();
        XQueryProcessor proc = new XQueryProcessor(xqmod);
        XQueryModule module = proc.parse(new FileInputStream(queryFile));
        return proc.execute(module);
    }
View Full Code Here

        long free = SystemUtils.getHeapFreeMemory();
        StringBuilder stdbuf = new StringBuilder(256);
        stdbuf.append(" - free(init): " + StringUtils.displayBytesSize(free));
        StopWatch sw = new StopWatch("[Xbird] " + queryFile);
        XQueryProcessor processor = new XQueryProcessor();
        XQueryModule mod = processor.parse(new FileInputStream(queryFile), new File(DOC_BASE).toURI());
        processor.compile(mod);
        System.err.println(mod.getExpression().toString());
        Sequence result = processor.execute(mod);
        StringWriter res_sw = new StringWriter();
        Serializer ser = new SAXSerializer(new SAXWriter(res_sw), res_sw);
View Full Code Here

      }
      file = new File(fName);
      // set the source only if the file exists
      if (file.exists() && file.isFile()) {
        if (file.getName().endsWith(getFileExtension() + FILE_EXTENSION_COMPRESSED)) {
          setSource(new GZIPInputStream(new FileInputStream(file)));
        } else {
          setSource(new FileInputStream(file));
        }
      }
   // }
  /*  catch (FileNotFoundException ex) {
      throw new IOException("File not found");
View Full Code Here

        //parse("D:/workspace/xbird/main/test/resources/org/metabrick/xbird/xquery/parser/data/for_norm02.xq");
    }   

    private static void parse(String path) throws Exception {
        System.out.println("Reading from: " + path);
        XQueryParser t = new XQueryParser(new FileInputStream(path));
        t.disable_tracing();
        final XQueryModule m;
        try {
            m = t.parse();
        } catch (Throwable e) {
View Full Code Here

                } else if (arg instanceof byte[]) {
                    in = new ByteArrayInputStream((byte[]) arg);
                } else if (arg instanceof MimePart) {
                    in = new ByteArrayInputStream(((MimePart) arg).getContent());
                } else if (arg instanceof File) {
                    in = new FileInputStream((File) arg);
                } else if (arg instanceof FileObject) {
                    in = new FileInputStream(((FileObject)arg).getFile());
                } else if (arg instanceof String) {
                    String str = (String) arg;
                    // try to interpret argument as URL if it contains a colon,
                    // otherwise or if URL is malformed interpret as file name.
                    if (str.indexOf(":") > -1) {
                        try {
                            URL url = new URL(str);
                            in = url.openStream();
                        } catch (MalformedURLException mux) {
                            in = new FileInputStream(str);
                        }
                    } else {
                        in = new FileInputStream(str);
                    }
                }
   
                if (in == null) {
                    String msg = "Unrecognized argument in Image.getInfo(): ";
View Full Code Here

    /**
     * utitilty function to create byte array from file
     */
    public static void main(String[] args) throws Exception {
        FileInputStream fis = new FileInputStream(args[0]);
        byte[] b = new byte[256];
        int linect = 0;
        int ct = 0;

        System.out.print("\n\n\n  static byte[] image = {\n    ");

        while (ct > -1) {
            ct = fis.read(b);

            for (int i = 0; i < ct; i++) {
                System.out.print(b[i] + ",");
                linect++;

View Full Code Here

        Logger.setLevel(Level.DEBUG);
       
        String propsfile = System.getProperty("ftptest.properties.filename", "test.properties");
               
        try {
            props.load(new FileInputStream(propsfile))
        }
        catch (IOException ex) {
            System.out.println("Failed to open " + propsfile);
            System.exit(-1);
        }      
View Full Code Here

            assertEquals(file1.length(), file2.length());
            log.debug("Identical size [" + file1.getName() +
                        "," + file2.getName() + "]");

            // now check each byte
            is1 = new BufferedInputStream(new FileInputStream(file1));
            is2 = new BufferedInputStream(new FileInputStream(file2));
            int ch1 = 0;
            int ch2 = 0;
            int count = 0;
            try {
                while ((ch1 = is1.read()) != -1 &&
View Full Code Here

TOP

Related Classes of java.io.FileInputStream

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.