Package java.io

Examples of java.io.FileInputStream.available()


                    privateKeyFile.read(privateKey);

                    controller.addKeyPair(command.getArg(0), new Certificate("X.509", publicKey), new Certificate("X.509", privateKey));
                } else if (command.getCommand() == CLICommand.Command.REMOVEKEY) {
                    FileInputStream publicKeyFile = new FileInputStream(command.getArg(1));
                    byte publicKey[] = new byte[(int) publicKeyFile.available()];
                    publicKeyFile.read(publicKey);

                    controller.removeKeyPair(command.getArg(0), new Certificate("X.509", publicKey));

                } else if (command.getCommand() == CLICommand.Command.SECUREMESSAGE) {
View Full Code Here


                    controller.removeKeyPair(command.getArg(0), new Certificate("X.509", publicKey));

                } else if (command.getCommand() == CLICommand.Command.SECUREMESSAGE) {
                    FileInputStream publicKeyFile = new FileInputStream(command.getArg(0));
                    byte publicKey[] = new byte[(int) publicKeyFile.available()];
                    publicKeyFile.read(publicKey);

                    Certificate cert = new Certificate("X.509", publicKey);
                    controller.messageRoom(command.getArg(2), new Message(controller.getUserName(command.getArg(2)), command.getArg(3), command.getArg(1), cert));
                }
View Full Code Here

            final Boolean b = WranglerBackendManager.getRefactoringBackend()
                    .callSimpleInspection(functionName, signature, parameters);
            if (b) {
                final FileInputStream fis = new FileInputStream(tmpFile);
                try {
                    if (fis.available() > 0) {

                        final Image img = GraphViz.load(fis, "png", new Point(0, 0));
                        CodeInspectionViewsManager.showDotImage(img, viewtTitle,
                                secondaryID, tmpFile);
                    } else {
View Full Code Here

            final MessageDigest digest = java.security.MessageDigest.getInstance("MD5");
            final FileInputStream fis = new FileInputStream(element);

            // Read Data
            final byte[] data = new byte[1024 * 1024];
            int avail = fis.available();

            // Update hash
            while (avail > 0) {
                avail = Math.min(avail, data.length);

View Full Code Here

                avail = Math.min(avail, data.length);

                fis.read(data, 0, avail);

                digest.update(data, 0, avail);
                avail = fis.available();
            }

            final byte[] hash = digest.digest();

            // Assemble hash string
View Full Code Here

public class Utils {

    public static String stringFromFile(String file) throws IOException {
        FileInputStream fis = new FileInputStream(file);
        try {
            int x = fis.available();
            if(x > 0) {
                byte b[]= new byte[x];
                int c = 0;
                while(c < x) {
                    c += fis.read(b, c, x-c);
View Full Code Here

      if ( finfo != null )
         reload = (lastmod != finfo.lastModified);
      if ( reload ) {
         try {
            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

         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()));
            }
View Full Code Here

     */

    public String
    getContent(Request request, File file, String encoding) throws IOException {
  FileInputStream in = new FileInputStream(file);
  byte[] buf = new byte[in.available()];
  in.read(buf);
  in.close();
  String result;
  if (encoding != null) {
      result = new String(buf, encoding);
View Full Code Here

        templateFile = server.props.getProperty(FileHandler.ROOT) +
          File.separator + templateFile;
      }
      server.log(Server.LOG_DIAGNOSTIC, prefix, "Template: " + templateFile);
      in = new FileInputStream(templateFile);
      byte[] contents = new byte[in.available()];
      in.read(contents);
      template = new String(contents);
      in.close();
  } catch (Exception e) {
      server.log(Server.LOG_ERROR, prefix, "Can't read template: " + 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.