Package java.io

Examples of java.io.RandomAccessFile.seek()


                   
                    int indexedContentLength = index[0][index[0].length - 1] + index[1][index[1].length - 1];
                   
                    if (contentLength != indexedContentLength) {
                        System.out.println(shape + " content length - shp: " + contentLength + ", shx: " + indexedContentLength);
                        raf.seek(24);
                        raf.writeInt(indexedContentLength);
                    }
                    raf.close();
                   
                } catch (Exception e) {
View Full Code Here


            /*
             * Go back and fill in component aggregate length in
             * location section
             */
            fout.seek(agg_loc);
            fout.writeInt((int) (Bound_sec_len + Frame_sec_len));

            fout.close();
            Debug.message("maketoc", "MakeToc: *** Normal end of make-toc ***");

 
View Full Code Here

        try {
            rfile = open(fileId, "r");

            /* get the record header(Hdr) */
            byte[] hdrArr = new byte[hdrLen];
            rfile.seek(offset);
            rfile.read(hdrArr, 0, hdrLen);

            Hdr hdr = new Hdr();

            if (hdr.read(hdrArr, 0)) {
View Full Code Here

            Hdr hdr = new Hdr();

            if (hdr.read(hdrArr, 0)) {
                int logRecLen = hdr.getLength();
                byte[] logObjArr = new byte[logRecLen];
                rfile.seek(offset);
                rfile.read(logObjArr, 0, logRecLen);

                return RecordFactory.createRecord(logObjArr, 0);
            } else {
                throw new ChaiDBException(ErrorCode.LOG_RECORD_HEADER_CANNOT_READ);
View Full Code Here

   //*-- Dump the file back into tfile with a list of unique file names
   //*-- Check if any of the files belong to the list of exclusion directories
   try
   {
    tfile = new RandomAccessFile(taskFile, "rw");
    tfile.setLength(0); tfile.seek(0);
    outp = new PrintWriter(new FileWriter(taskFile));
   
    if (h != null)
     { String[] keys = h.keys();
       FLOOP: for (int i = 0; i < keys.length; i++)
View Full Code Here

        }

        randAccessContentFile.setLength(range.length);

        // Append data in request input stream to contentFile
        randAccessContentFile.seek(range.start);
        int numBytesRead;
        byte[] transferBuffer = new byte[BUFFER_SIZE];
        BufferedInputStream requestBufInStream =
            new BufferedInputStream(req.getInputStream(), BUFFER_SIZE);
        while ((numBytesRead = requestBufInStream.read(transferBuffer)) != -1) {
View Full Code Here

      throw new CannotReadException("Less than 150 byte \""+f.getAbsolutePath()+"\"");
   
    RandomAccessFile raf = null;
    try{
      raf = new RandomAccessFile( f, "r" );
      raf.seek( 0 );
     
      EncodingInfo info = getEncodingInfo(raf);
   
      Tag tag;
      try {
View Full Code Here

     
      EncodingInfo info = getEncodingInfo(raf);
   
      Tag tag;
      try {
        raf.seek( 0 );
        tag = getTag(raf);
      } catch (CannotReadException e) {
        System.err.println(e.getMessage());
        tag = new GenericTag();
      }
View Full Code Here

      tempF = File.createTempFile("entagged", ".tmp", f.getParentFile());
      rafTemp = new RandomAccessFile(tempF, "rw");
      raf = new RandomAccessFile(f, "rw");
      raf.seek(0);
      rafTemp.seek(0);

      try {
        if (this.modificationListener != null) {
          this.modificationListener.fileWillBeModified(f, true);
        }
View Full Code Here

      tempF = File.createTempFile("entagged", ".tmp", af.getParentFile());
      rafTemp = new RandomAccessFile(tempF, "rw");
      raf = new RandomAccessFile(af, "rw");
      raf.seek(0);
      rafTemp.seek(0);
      try {
        if (this.modificationListener != null) {
          this.modificationListener.fileWillBeModified(af, false);
        }
        writeTag(af.getTag(), raf, rafTemp);
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.