Package java.io

Examples of java.io.FileInputStream.available()


           
            String cmd = "-T" + getDotFormat() + " \"" + dotSrc.getCanonicalPath() + "\" -o\"" + dotImg.getAbsolutePath() + "\"";
            Dot.run(cmd);
           
            InputStream is = new FileInputStream(dotImg);
            if (is.available() == 0) {
                throw new Exception("Error while rendering dot file");
            }
            response.setContentType(getContentType());
            response.setContentLength(is.available());
            FileUtil.copyInputStream(is, response.getOutputStream());
View Full Code Here


            InputStream is = new FileInputStream(dotImg);
            if (is.available() == 0) {
                throw new Exception("Error while rendering dot file");
            }
            response.setContentType(getContentType());
            response.setContentLength(is.available());
            FileUtil.copyInputStream(is, response.getOutputStream());
        } finally {
            if (dotSrc != null) {
                //dotSrc.delete();
            }
View Full Code Here

        };

    private void checkFile(File file) {
        try {
            FileInputStream fis = new FileInputStream(file);
            byte[] bytes = new byte[fis.available()];
            fis.read(bytes);
            String content = new String(bytes);

            for (int i = 0; i < avoidPatterns.length; i++) {
                if (avoidPatterns[i].noMatch(file.getPath(), content)) {
View Full Code Here

            Class c = (Class) cache.get(classname);
            if (c == null) {
                try {
                    File file = getClassFile(classname);
                    FileInputStream fis = new FileInputStream(file);
                    byte[] data = new byte[fis.available()];
                    fis.read(data);
                    fis.close();
                    c = defineClass(classname, data, 0, data.length);
                    dates.put(classname, new Long(file.lastModified()));
                } catch (Throwable t) {
View Full Code Here

        FileCacheInfo finfo = (FileCacheInfo) cache.get(file);
        long lastmod = file.lastModified();
        if (finfo == null || finfo.lastModified != lastmod) {
            FileInputStream fis = new FileInputStream(file);
            byte[] content = new byte[fis.available()];
            fis.read(content);
            fis.close();
            finfo = new FileCacheInfo(file, lastmod, content);
            cache.put(file, finfo);
            return content;
View Full Code Here

      dstream.writeBytes("Content-Type: image/jpeg\r\n");

      dstream.writeBytes("Content-Transfer-Encoding: binary\r\n\r\n");

      int bytesAvailable = fileInputStream.available();

      int maxBufferSize = 1024;
      int bufferSize = Math.min(bytesAvailable, maxBufferSize);

      byte[] buffer = new byte[bufferSize];
View Full Code Here

      int bytesRead = fileInputStream.read(buffer, 0, bufferSize);

      while (bytesRead > 0) {
        dstream.write(buffer, 0, bufferSize);
        bytesAvailable = fileInputStream.available();
        bufferSize = Math.min(bytesAvailable, maxBufferSize);
        bytesRead = fileInputStream.read(buffer, 0, bufferSize);

      }
View Full Code Here

     *     excpected number of parameters (in the source code).
     */
    private void checkMessages(File file) {
        try {
            FileInputStream fis = new FileInputStream(file);
            byte[] bytes = new byte[fis.available()];
            fis.read(bytes);
            String string = new String(bytes);
            int index = string.indexOf("JavaUtils.getMessage(");
            while (index >= 0) {

View Full Code Here

        };

    private void checkFile(File file) {
        try {
            FileInputStream fis = new FileInputStream(file);
            byte[] bytes = new byte[fis.available()];
            fis.read(bytes);
            String content = new String(bytes);

            for (int i = 0; i < avoidPatterns.length; i++) {
                if (avoidPatterns[i].noMatch(file.getPath(), content)) {
View Full Code Here

            throw new CertificateStoreException("No certificate with serial number "+sNo+" found.");
        }
        FileInputStream fin;
        try {
            fin = new FileInputStream(certFile);
            byte[] data = new byte[fin.available()];
            fin.read(data);
            fin.close();
            return new String(data);
        } catch (Exception e) {
            throw new CertificateStoreException("Error while retrieving certificate.", e);
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.