Package java.io

Examples of java.io.FileInputStream.available()


   
    // this variable will hold the file's whole content
    String fileContent="";
    try{
      FileInputStream fis = new FileInputStream(expectedFile);
      byte[] buff=new byte[fis.available()];
      fis.read(buff);
      fileContent=new String(buff);
      fis.close();
    }
    // IO Exception can be ignored here
View Full Code Here


   * Arguments are: 0. Name of input SWF file.
   */
  public static void main(String[] args) throws IOException {
    FileInputStream in = new FileInputStream(args[0]);

    byte[] buf = new byte[in.available()];
    in.read(buf);
    in.close();
    SWFParser parser = new SWFParser();
    ParseResult parseResult = parser.getParse(new Content("file:" + args[0], "file:" + args[0],
                                          buf, "application/x-shockwave-flash",
View Full Code Here

        List<String> ruleFiles = new ArrayList<String>();
        for (int i = firstFile; i < files.length; i++) {
            String file = files[i];
            try {
                FileInputStream fis = new FileInputStream(new File(file));
                int max = fis.available();
                int read;
                int count;
                byte[] bytes = new byte[max];
                count = fis.read(bytes);
                read = count;
View Full Code Here

        List<String> ruleFiles = new ArrayList<String>();
        for (int i = firstFile; i < files.length; i++) {
            String file = files[i];
            try {
                FileInputStream fis = new FileInputStream(new File(file));
                int max = fis.available();
                int read;
                int count;
                byte[] bytes = new byte[max];
                count = fis.read(bytes);
                read = count;
View Full Code Here

        // look up rules in any script files

        for (String scriptPath : scriptPaths) {
            try {
                FileInputStream fis = new FileInputStream(scriptPath);
                byte[] bytes = new byte[fis.available()];
                fis.read(bytes);
                String ruleScript = new String(bytes);
                scripts.add(ruleScript);
            } catch (IOException ioe) {
                System.err.println("org.jboss.byteman.agent.Main: unable to read rule script file : " + scriptPath);
View Full Code Here

        //impl.createCategory( "/", "testExportPackageCat2", "desc" );

        File file = new File( "testExportPackage.xml" );

        FileInputStream fis = new FileInputStream( file );
        byte[] byteArray = new byte[fis.available()];
        fis.read( byteArray );

        repositoryPackageService.importPackages( byteArray,
                                                 true );
View Full Code Here

    private void readFile(final File file) {
        AccessController.doPrivileged(new PrivilegedAction<Void>() {
            public Void run() {
                try {
                    FileInputStream fis = new FileInputStream(file);
                    byte[] data = new byte[fis.available()];
                    fis.read(data);
                    textArea.setText(new String(data));
                    textArea.setCaretPosition(0);
                    fis.close();
                } catch (FileNotFoundException fnfe) {
View Full Code Here

    private void readFile(final File file) {
        AccessController.doPrivileged(new PrivilegedAction<Object>() {
            public Object run() {
                try {
                    FileInputStream fis = new FileInputStream(file);
                    byte[] data = new byte[fis.available()];
                    fis.read(data);
                    textArea.setText(new String(data));
                    fis.close();
                } catch (FileNotFoundException fnfe) {
                    JOptionPane.showMessageDialog(Editor.this, "File not found: " + file);
View Full Code Here

        {
            String f = file.getName();
            /* Get the callout name from the file */
            String callout = f.split(extn_)[0];
            FileInputStream fis = new FileInputStream(file);
            byte[] bytes = new byte[fis.available()];
            fis.read(bytes);
            fis.close();
            /* cache the callout after compiling it */
            try
            {
View Full Code Here

        FileOutputStream fos = new FileOutputStream("C:\\Engagements\\bf.dat", true);
        fos.write(bufOut.getData(), 0, bufOut.getLength());
        fos.close();
       
        FileInputStream fis = new FileInputStream("C:\\Engagements\\bf.dat");
        byte[] bytes = new byte[fis.available()];
        fis.read(bytes);
        DataInputBuffer bufIn = new DataInputBuffer();
        bufIn.reset(bytes, bytes.length );
        BloomFilter bf2 = BloomFilter.serializer().deserialize(bufIn);
       
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.