Package java.io

Examples of java.io.RandomAccessFile.seek()


        while (localSearches.size() > 0) {
            addToDump(localSearches.removeFirst());
        }
        try {
            RandomAccessFile raf = new RandomAccessFile(file, "rw");
            raf.seek(raf.length());
            for (String s: log) {
                raf.write(UTF8.getBytes(s));
                raf.writeByte(10);
            }
            log.clear();
View Full Code Here


    public static byte[] read(File f, long start, int len) {
        byte[] b = new byte[len];
        RandomAccessFile raf = null;
        try {
            raf = new RandomAccessFile(f, "r");
            raf.seek(start);
            raf.read(b);
        } catch (IOException e) {
            Log.logException(e);
            return null;
        } finally {
View Full Code Here

            return null;
        }
        final RandomAccessFile raf = new RandomAccessFile(file, "r");
        final byte[] a = new byte[mb];
        try {
            raf.seek(0);
            raf.readFully(a, 0, mb);
            digest.update(a, 0, mb);
            raf.seek(fl - mb);
            raf.readFully(a, 0, mb);
            digest.update(a, 0, mb);
View Full Code Here

        final byte[] a = new byte[mb];
        try {
            raf.seek(0);
            raf.readFully(a, 0, mb);
            digest.update(a, 0, mb);
            raf.seek(fl - mb);
            raf.readFully(a, 0, mb);
            digest.update(a, 0, mb);
            digest.update(NaturalOrder.encodeLong(fl, 8), 0, 8);
            if (includeDate) digest.update(NaturalOrder.encodeLong(file.lastModified(), 8), 0, 8);
        } finally {
View Full Code Here

        // read the log from the dump
        long sizeAfter = logFile.length();
        if (sizeAfter <= sizeBefore) return;

        RandomAccessFile raf = new RandomAccessFile(logFile, "r");
        raf.seek(sizeBefore);
        byte[] b = new byte[(int) (sizeAfter - sizeBefore)];
        raf.readFully(b);
        raf.close();
       
        // import the thread dump;
View Full Code Here

            spooler_log.info("log file from previous job execution not found: " + prevLogFile.getCanonicalPath() );
          }
         
          checkPrevFile = new RandomAccessFile(prevLogFile, "r");
          if (logFilepointer > 0) {
            checkPrevFile.seek(logFilepointer);
            spooler_log.debug3("starting to check previous log file [" + prevLogFile.getCanonicalPath() + "] from position: " + logFilepointer);
          }
          //alte Fehlermeldung merken
          while((logLine = checkPrevFile.readLine()) != null) {
            if (logLine.matches( "^\\d{4}-\\d{1,2}-\\d{1,2} +\\d{1,2}:\\d{1,2}:\\d{1,2}(\\.\\d{1,3})? +\\[WARN\\] +.*" )) {
View Full Code Here

      byte[] bytes = new byte[(int) (rwFile.length())];
      int i = 0;
      while ((bytes[i++] = (byte) rwFile.read()) != -1)
        ;
      rwFile.seek(0);
      for (i = 0; i < bytes.length; i++)
        bytes[i] = (byte) ((Math.random() * 10) % 9);
      rwFile.write(bytes);
      rwFile.close();
      logger.debug9("Deleting file");
View Full Code Here

  public void filewrite( String s )
  {
    try {
      RandomAccessFile w =
        new RandomAccessFile( target, "rw" );;
      w.seek( w.length() );
      w.writeBytes( s );
      w.close();
    } catch ( Exception e ) {
      System.out.println("Debug output file write failed");
    }
View Full Code Here

                bufSize = (int)length;
            }
           
            byte[] inputBuffer = new byte[bufSize];

            raf.seek(0);
       
            int readAmount;
            while ((readAmount = raf.read(inputBuffer, 0, bufSize)) > 0) {
                out.write(inputBuffer, 0, readAmount);
            }
View Full Code Here

                    if (exif.read(file))
                    {
                        JTiffHeader tiffHeader = new JTiffHeader();
                        if (tiffHeader.read(file))
                        {
                            file.seek(tiffHeader.getOffset() + tiffHeader.getIFDOffset());
                            flag = read(file, tiffHeader.isIntel(), tiffHeader.getOffset());
                        }
                    }
                }
            }
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.