Package java.io

Examples of java.io.RandomAccessFile.readLine()


        File the_file = new File (aFile);
        try {
            RandomAccessFile raf = new RandomAccessFile(the_file, "r");
            String res="";
            while (!res.equals("["+aTestbase.toUpperCase()+"]")) {
                res = raf.readLine();
            }
            res="=/";
            while ( (!res.startsWith(aPlatform)) || (res.startsWith("[")) ) {
                res = raf.readLine();
            }
View Full Code Here


            while (!res.equals("["+aTestbase.toUpperCase()+"]")) {
                res = raf.readLine();
            }
            res="=/";
            while ( (!res.startsWith(aPlatform)) || (res.startsWith("[")) ) {
                res = raf.readLine();
            }
            raf.close();
            if (res.startsWith("[")) res="/";
            return res.substring(res.indexOf("=")+1);
View Full Code Here

        }
        file.write(jvmName.getBytes(Charsets.UTF_8));
        LOG.info("Lock on " + lockF + " acquired by nodename " + jvmName);
      } catch(OverlappingFileLockException oe) {
        // Cannot read from the locked file on Windows.
        String lockingJvmName = Path.WINDOWS ? "" : (" " + file.readLine());
        LOG.error("It appears that another namenode" + lockingJvmName
            + " has already locked the storage directory");
        file.close();
        return null;
      } catch(IOException e) {
View Full Code Here

      // The actual behavior, and spec'd in 1.2, is to strip the line terminator.  Its presence is
      //   inferred from readLine's returning the correct string up to, but not including, the terminator.
      raf.seek(0);
      raf.writeBytes("foobar\n");
      raf.seek(0);
      harness.check(raf.readLine(), "foobar", "writeBytes(s)/readLine()");

      // writeChar(c)/writeChars(s)/readChar()
      raf.seek(0);
      raf.writeChar('f');
      raf.writeChars("oobar");
View Full Code Here

        tail.append("\n-------------------- "+tag+"---------------------\n");
        String[] lines = null;
        if (num >0) {
          lines = new String[num];
        }
        while ((line = rafile.readLine()) != null) {
          no_lines++;
          if (num >0) {
            if (no_lines <= num) {
              lines[no_lines-1] = line;
            }
View Full Code Here

        tail.append("\n-------------------- "+tag+"---------------------\n");
        String[] lines = null;
        if (num >0) {
          lines = new String[num];
        }
        while ((line = rafile.readLine()) != null) {
          no_lines++;
          if (num >0) {
            if (no_lines <= num) {
              lines[no_lines-1] = line;
            }
View Full Code Here

        int lines=0;
        try{
            while(true){
                String line=null;
                try {
                    line = raf.readLine();
                } catch (IOException ex) {
                    ex.printStackTrace();
                    break;
                }
                if (line==null)
View Full Code Here

    if (currentSize > savedSize) {
      try (RandomAccessFile accessFile = new RandomAccessFile(
            fileName, "r")) {
          accessFile.seek(savedSize);
         
          String line = accessFile.readLine();
          do {
            if (!line.isEmpty()) {
              notifyListeners(line);
            }
          } while ((line = accessFile.readLine()) != null);
View Full Code Here

          String line = accessFile.readLine();
          do {
            if (!line.isEmpty()) {
              notifyListeners(line);
            }
          } while ((line = accessFile.readLine()) != null);
         
          savedSize = currentSize;
      } catch (IOException e) {
        logger.severe(e.getMessage());
      }
View Full Code Here

        String links;

        try {
            RandomAccessFile file = new RandomAccessFile(name, "r");
            while (file.getFilePointer() < file.length()) {
                stringRegeln.add(file.readLine());
            }
            file.close();
        } catch (final IOException e) {
            System.err.println(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.