Load / append a ZMsg from an open DataInputStream

@param file
DataInputStream connected to file
@return
ZMsg object
354829
public static ZMsg load(DataInputStream file)
    {
        if (file == null) {
            return null;
        }
        ZMsg rcvMsg = new ZMsg();

        try {
            int msgSize = file.readInt();
            if (msgSize > 0) {
                int msgNbr = 0;
                while (++msgNbr <= msgSize) {
                    int frameSize = file.readInt();
                    byte[] data = new byte[frameSize];
                    file.read(data);
                    rcvMsg.add(new ZFrame(data));
                }
            }
            return rcvMsg;
        }
        catch (IOException e) {
            return null;
        }
    }
79089
public static Properties loadProperties(File file) throws IOException {
        FileInputStream finp = new FileInputStream(file);
        try {
            Properties p = new Properties();
            p.load(finp);
            return p;
        } finally {
            ArchiveUtils.closeQuietly(finp);
        }
    }
7073
public void load(File file) {
    try {
      PropertiesConfiguration config = new PropertiesConfiguration();
      // disabled to prevent accumulo classpath value from being shortened
      config.setDelimiterParsingDisabled(true);
      config.load(file);
      ((CompositeConfiguration) internalConfig).addConfiguration(config);
    } catch (ConfigurationException e) {
      throw new IllegalArgumentException(e);
    }
  }
257679
public static String read(final File file) throws IOException {
        final StringBuilder sb = new StringBuilder();

        try (
                final FileReader fr = new FileReader(file);
                final BufferedReader br = new BufferedReader(fr);
        ) {

            String sCurrentLine;

            while ((sCurrentLine = br.readLine()) != null) {
                sb.append(sCurrentLine);
            }
        }

        return sb.toString();
    }
250145
public static byte[] loadBytesFromFile(File file) {

		byte[] bytes = null;
		try {
			bytes = Files.readAllBytes(Paths.get(file.getAbsolutePath()));
		} catch (IOException e) {
			e.printStackTrace();
		}
		return bytes;
	}
540040
public static String readFile(File file) {
		FileInputStream inputStream;
		try {
			inputStream = new FileInputStream(file);
			return new String(readStream(inputStream));
		} catch (FileNotFoundException e) {
			JK.throww(e);
			return null;
		}
	}
1157680
private static void addFile(final File file, final File dirToZip, final ZipOutputStream zos)
		throws IOException
	{
		final String absolutePath = file.getAbsolutePath();
		final int index = absolutePath.indexOf(dirToZip.getName());
		final String zipEntryName = absolutePath.substring(index, absolutePath.length());
		final byte[] b = new byte[(int)file.length()];
		final ZipEntry cpZipEntry = new ZipEntry(zipEntryName);
		zos.putNextEntry(cpZipEntry);
		zos.write(b, 0, (int)file.length());
		zos.closeEntry();
	}
1074599
public static String fromFile(File file) throws IOException {
        BufferedReader br = new BufferedReader(new FileReader(file));
        StringBuilder sb = new StringBuilder();
        String line = br.readLine();

        while (line != null) {
            sb.append(line);
            line = br.readLine();
            if (line != null)
                sb.append(System.lineSeparator());
        }

        br.close();
        return sb.toString();
    }
375521
public static Properties load(File file) throws IOException {
        if (file.isFile()) {
            return load(file.toURI().toURL());
        }
        return new Properties();
    }
16359
public void loadFile(File file)
   {
      InputStream is = null;

      try
      {
         is = new FileInputStream(file);
         POIFSFileSystem fs = new POIFSFileSystem(is);
         m_model.setFile(fs);
      }

      catch (IOException ex)
      {
         throw new RuntimeException(ex);
      }

      finally
      {
         StreamHelper.closeQuietly(is);
      }
   }
182971
protected static Properties loadConfig(File file) {
    InputStream is = null;
    try {
      is = new FileInputStream(file);
      return loadConfig(file.getAbsolutePath(), is);     
    } catch (Exception ex) {
      throw new IllegalArgumentException("Failed to load configuration from [" + file.getAbsolutePath() + "]");
    }finally {
      if(is!=null) try { is.close(); } catch (Exception ex) { /* No Op */ }
    }
  }
1241562
private void loadCertificateFromFile(File file) {

    certificateFileSanityChecks(file);

    try {

      X509Certificate aaCert = CertificateUtils.loadCertificate(
        new FileInputStream(file), Encoding.PEM);

      // Get certificate subject hash, using the CANL implementation for CA
      // files
      String aaCertHash = getOpensslCAHash(aaCert.getSubjectX500Principal());

      // Store certificate in the local map
      localAACertificatesByHash.put(aaCertHash, aaCert);

      synchronized (listenerLock) {
        listener.notifyCertificateLoadEvent(aaCert, file);
      }

    } catch (IOException e) {
      String errorMessage = String.format(
        "Error parsing VOMS trusted certificate from %s. Reason: %s",
        file.getAbsolutePath(), e.getMessage());
      throw new VOMSError(errorMessage, e);
    }

  }
736007
private static InputStream getFileAsInputStream(String file) throws InitializationException {
		if (file == null) {
			throw new NullPointerException("File is null");
		}
		try {
			return new FileInputStream(new File(file));
		} catch (FileNotFoundException e) {
			throw new InitializationException("File not found: " + file);
		}
	}
476899
public static <MSG extends Message> MSG read(File file, Parser<MSG> parser) {
    InputStream input = null;
    try {
      input = new BufferedInputStream(new FileInputStream(file));
      return parser.parseFrom(input);
    } catch (Exception e) {
      throw ContextException.of("Unable to read message", e).addContext("file", file);
    } finally {
      IOUtils.closeQuietly(input);
    }
  }
340325
public static Observable<Fix> from(final File file, BinaryFixesFormat format) {

        Func0<InputStream> resourceFactory = new Func0<InputStream>() {

            @Override
            public InputStream call() {
                try {
                    if (file.getName().endsWith(".gz"))
                        return new GZIPInputStream(new FileInputStream(file));
                    else
                        return new FileInputStream(file);
                } catch (FileNotFoundException e) {
                    throw new RuntimeException(e);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
        };

        Func1<InputStream, Observable<Fix>> obsFactory = new Func1<InputStream, Observable<Fix>>() {

            @Override
            public Observable<Fix> call(InputStream is) {
                Optional<Integer> mmsi;
                if (format == BinaryFixesFormat.WITH_MMSI)
                    mmsi = Optional.absent();
                else
                    mmsi = Optional.of(BinaryFixesUtil.getMmsi(file));

                return Observable.create(new BinaryFixesOnSubscribeWithBackp(is, mmsi, format));
            }
        };
        Action1<InputStream> disposeAction = new Action1<InputStream>() {

            @Override
            public void call(InputStream is) {
                try {
                    is.close();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
        };
        return Observable.using(resourceFactory, obsFactory, disposeAction, true);

    }
519048
public static Properties fromFile(
    final File file)
    throws IOException
  {
    Objects.requireNonNull(file, "File");

    try (InputStream stream = Files.newInputStream(file.toPath())) {
      final Properties p = new Properties();
      p.load(stream);
      return p;
    }
  }
1059961
public static RegionMetadata load
    (final File file) throws IOException {
        return RegionMetadataParser.parse(new BufferedInputStream(new
                FileInputStream(file)));
    }