Package java.io

Examples of java.io.FileInputStream.available()


            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


    public BigInteger getHighestSerialNumber() throws CertificateStoreException{
        if(highestSerialNumber == null) {
            // Value has not been cached.  Read from the disk.
            try {
                FileInputStream finp = new FileInputStream(highestSerialFile);
                byte[] data = new byte[finp.available()];
                finp.read(data);
                finp.close();
                highestSerialNumber = new BigInteger(new String(data).trim());
            } catch (Exception e) {
                throw new CertificateStoreException("Error while getting serial number.", e);
View Full Code Here

            try {
               if (trace) {
                  log.tracef("Opening file in %s", file);
               }
               fileInStream = new FileInputStream(file);
               int sz = fileInStream.available();
               bis = new BufferedInputStream(fileInStream);
               objectOutput.writeObject(file.getName());
               objectOutput.writeInt(sz);

               while (sz > totalBytesRead) {
View Full Code Here

      HowlRecord rec = new DefaultHowlRecord();
      rec.readFields(inpStream);
      Assert.assertEquals(recs[i],rec);
    }

    Assert.assertEquals(fInStream.available(), 0);
    fInStream.close();

  }

  public void testCompareTo() {
View Full Code Here

  public static Class loadClassDefinition(String path, String packageName, String className) throws IOException {
    if (path == null) return null;

    FileInputStream inputStream = new FileInputStream(path);
    byte[] classDefinition = new byte[inputStream.available()];

    String classBase = path.substring(0, path.length() - ".class".length());

    BootstrapClassloader clsLoader = new BootstrapClassloader(new File(path).getParentFile().getAbsolutePath(),
            "system".equals(classLoadingMode) ?
View Full Code Here

        String innerClassBaseName = classBase + "$" + s;
        File innerClass = new File(innerClassBaseName + ".class");
        if (innerClass.exists()) {
          try {
            inputStream = new FileInputStream(innerClass);
            classDefinition = new byte[inputStream.available()];
            inputStream.read(classDefinition);

            clsLoader.defineClassX(fqcn, classDefinition, 0, classDefinition.length);
          }
          finally {
View Full Code Here

      String innerClassBaseName = classBase + "$" + i;
      File innerClass = new File(innerClassBaseName + ".class");
      if (innerClass.exists()) {
        try {
          inputStream = new FileInputStream(innerClass);
          classDefinition = new byte[inputStream.available()];
          inputStream.read(classDefinition);

          clsLoader.defineClassX(fqcn, classDefinition, 0, classDefinition.length);
        }
        finally {
View Full Code Here

          File innerClass = new File(searchPath + "/" + name.substring(name.lastIndexOf('.') + 1) + ".class");
          if (innerClass.exists()) {
            try {
              inputStream = new FileInputStream(innerClass);
              classDefinition = new byte[inputStream.available()];
              inputStream.read(classDefinition);

              return defineClassX(name, classDefinition, 0, classDefinition.length);
            }
            finally {
View Full Code Here

    public CopyTest(String fname, String fname2) throws FileNotFoundException, IOException {
        byte[] bbuf = new byte[1024];

        FileInputStream fis = new FileInputStream(fname);
        FileOutputStream fos = new FileOutputStream(fname2, false);
        while (fis.available() > 0) {
            System.out.print(".");
            int len = fis.read(bbuf);
            fos.write(bbuf, 0, len);
        }
View Full Code Here

      String innerClassBaseName = classBase + "$" + i;
      File innerClass = new File(innerClassBaseName + ".class");
      if (innerClass.exists()) {
        try {
          inputStream = new FileInputStream(innerClass);
          classDefinition = new byte[inputStream.available()];
          inputStream.read(classDefinition);

          clsLoader.defineClassX(fqcn, classDefinition, 0, classDefinition.length);
        }
        finally {
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.