Package java.io

Examples of java.io.RandomAccessFile


    }

    /*
     * Now try InputCapture which may also yield a known format
     */
    ReadableByteChannel channel = new RandomAccessFile(file, "r").getChannel();
    FormatType.Detail detail = formatTypeDetail(channel);
    channel.close();

    if (logger.isTraceEnabled()) {
      logger.trace(file.getName() + ", type=" + FormatType.Pcap + ", detail="
View Full Code Here


    final long count;

    switch (type) {
      case Other:
        final ReadableByteChannel channel =
            new RandomAccessFile(dst, "r").getChannel();
        final InputCapture<? extends CapturePacket> input =
            newInput(channel, null);
        count = Captures.count(input.getPacketIterator());
        input.close();
        break;
View Full Code Here

    }
    if (mode.indexOf('w')>=0) {
      context.checkWrite(_file.getPath());
    }
    if (_access == null) {
      _access = new RandomAccessFile(_file, mode);
    }
  }
View Full Code Here

    }

    protected final RandomAccessFile ensureResourceOpen() throws DbException {
        if(_raf == null) {
            try {
                this._raf = new RandomAccessFile(_file, "rw");
            } catch (FileNotFoundException e) {
                throw new DbException(e);
            }
        }
        if(_fc == null) {
View Full Code Here

                if(!created) {
                    throw new IllegalStateException("could'nt create file: "
                            + file.getAbsolutePath());
                }
            }
            this.raf = new RandomAccessFile(file, "rw");
        }
        this.open = true;
    }
View Full Code Here

                    throw new IllegalStateException("create file failed: "
                            + descFile.getAbsolutePath());
                }
            }
            this.descFile = descFile;
            this.raf = new RandomAccessFile(descFile, "rw");
            this.purgeUnits = cacheSize;
        }
View Full Code Here

    }

    public NioFixedSegment(File file, int recordLength, boolean readOnly) {
        this.file = file;
        this.recordLength = recordLength;
        final RandomAccessFile raf;
        try {
            raf = new RandomAccessFile(file, readOnly ? "r" : "rw");
        } catch (FileNotFoundException e) {
            throw new IllegalStateException("File not found: " + file.getAbsolutePath(), e);
        }
        this.channel = raf.getChannel();
    }
View Full Code Here

    private int hpos;

    private int hslots;

    public ReadOnlyCDB(String filename) throws IOException {
        file = new RandomAccessFile(filename, "r");
        FileChannel channel = file.getChannel();
        map = channel.map(MapMode.READ_ONLY, 0, file.length());
        map.order(ByteOrder.LITTLE_ENDIAN);
    }
View Full Code Here

    public DiskHashTable(File file, int initMapSize) {
        if(file == null) {
            throw new IllegalArgumentException();
        }
        try {
            this.raf = new RandomAccessFile(file, "rw");
        } catch (FileNotFoundException e) {
            throw new IllegalStateException("File not found: " + file.getAbsolutePath(), e);
        }
        this.index = new Bytes2LongOpenHash(initMapSize);
    }
View Full Code Here

    private RandomAccessFile raf;
    private long datapos = HEADER_SIZE;

    public CDB(File file) {
        try {
            this.raf = new RandomAccessFile(file, "rw");
        } catch (FileNotFoundException e) {
            throw new IllegalStateException(e);
        }
        this.slotPos = new int[NUM_SLOTS];
        this.slotLen = new int[NUM_SLOTS];
View Full Code Here

TOP

Related Classes of java.io.RandomAccessFile

Copyright © 2018 www.massapicom. 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.