Package java.io

Examples of java.io.RandomAccessFile.readByte()


                }

                int entryFlagsOffset = (int) (DbLsn.getFileOffset(lsn) +
                                              LogEntryHeader.FLAGS_OFFSET);
                file.seek(entryFlagsOffset);
                byte flags = file.readByte();
                byte newFlags = LogEntryHeader.makeInvisible(flags);
                file.seek(entryFlagsOffset);
                file.writeByte(newFlags);
            }
        } catch (IOException e) {
View Full Code Here


            threadLock.lock();
            try {
                if (location.getSize() == Location.NOT_SET) {
                    raf.seek(location.getOffset());
                    location.setSize(raf.readInt());
                    location.setType(raf.readByte());
                } else {
                    raf.seek(Journal.HEADER_SIZE + location.getOffset());
                }
                if (location.isBatchControlRecord()) {
                    byte[] data = new byte[raf.readInt()];
View Full Code Here

            threadLock.lock();
            try {
                if (raf.length() > location.getOffset()) {
                    raf.seek(location.getOffset());
                    location.setSize(raf.readInt());
                    location.setType(raf.readByte());
                    if (location.getSize() > 0 && location.getType() != Location.NO_RECORD_TYPE) {
                        return true;
                    } else {
                        return false;
                    }
View Full Code Here

      in.seek(seekAddr);
     
      // determine if we're too high, too low, or right on
      byte[] record = null;
      for(int i = maxLongNameLength - 1; i >= 0 ; i--) {
        byte byt = in.readByte();
        if(record == null) {
          if(byt != InfoToken.reservedToken) {
            record = new byte[i+1];
            record[i] = byt;
          }
View Full Code Here

                            file.writeBytes("+");
                            file.seek(file.getFilePointer() + 36);
                        }
                    }
                    //  Skip end of line, LF or CRLF
                    if (file.readByte() == '\r')
                        file.readByte();
                    if (Thread.currentThread().isInterrupted())
                        break;
                }
            } catch (FileNotFoundException e) {
View Full Code Here

                            file.seek(file.getFilePointer() + 36);
                        }
                    }
                    //  Skip end of line, LF or CRLF
                    if (file.readByte() == '\r')
                        file.readByte();
                    if (Thread.currentThread().isInterrupted())
                        break;
                }
            } catch (FileNotFoundException e) {
            } catch (IOException e) {
View Full Code Here

    public void test_readByte() throws IOException {
        // Test for method byte java.io.RandomAccessFile.readByte()
        RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
        raf.writeByte(127);
        raf.seek(0);
        assertEquals("Incorrect bytes read/written", 127, raf.readByte());
        raf.close();
    }

    /**
     * @tests java.io.RandomAccessFile#readChar()
View Full Code Here

    public void test_writeByteI() throws IOException {
        // Test for method void java.io.RandomAccessFile.writeByte(int)
        RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
        raf.writeByte(127);
        raf.seek(0);
        assertEquals("Incorrect byte read/written", 127, raf.readByte());
        raf.close();
    }

    /**
     * @tests java.io.RandomAccessFile#writeBytes(java.lang.String)
View Full Code Here

    public void test_writeByteI() throws IOException {
        // Test for method void java.io.RandomAccessFile.writeByte(int)
        RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
        raf.writeByte(127);
        raf.seek(0);
        assertEquals("Incorrect byte read/written", 127, raf.readByte());
        raf.close();
    }

    /**
     * @tests java.io.RandomAccessFile#writeBytes(java.lang.String)
View Full Code Here

    public void test_readByte() throws IOException {
        // Test for method byte java.io.RandomAccessFile.readByte()
        RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
        raf.writeByte(127);
        raf.seek(0);
        assertEquals("Incorrect bytes read/written", 127, raf.readByte());
        raf.close();
    }

    /**
     * @tests java.io.RandomAccessFile#readChar()
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.