Package java.io

Examples of java.io.RandomAccessFile.skipBytes()


                            0, 8,
                            // method
                            8, 0,
                        }, header);
                    // ignore timestamp
                    a.skipBytes(4);
                    crc = new byte[4];
                    a.readFully(crc);
                    assertArrayEquals(new byte[] {
                            (byte) 0x9E, (byte) 0xCB,
                            (byte) 0x79, (byte) 0x12,
View Full Code Here


                    assertArrayEquals(new byte[] {
                            (byte) 0x9E, (byte) 0xCB,
                            (byte) 0x79, (byte) 0x12,
                        }, crc);
                    // skip compressed size
                    a.skipBytes(4);
                    rest = new byte[9];
                    a.readFully(rest);

                    boolean hasExtra =
                        mode == Zip64Mode.AsNeeded && !knownSize;
View Full Code Here

        // Test for method int java.io.RandomAccessFile.skipBytes(int)
        byte[] buf = new byte[5];
        RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
        raf.writeBytes("HelloWorld");
        raf.seek(0);
        raf.skipBytes(5);
        raf.readFully(buf);
        assertEquals("Failed to skip bytes", "World", new String(buf, 0, 5));
        raf.close();
    }
View Full Code Here

        try {
            journal.sync();
            //
            RandomAccessFile raf = getOrCreateRaf(Thread.currentThread(), location.getDataFileId());
            if (seekToLocation(raf, location)) {
                raf.skipBytes(Journal.RECORD_POINTER_SIZE + Journal.RECORD_LENGTH_SIZE);
                raf.write(type);
                location.setType(type);
                if (sync) {
                    IOHelper.sync(raf.getFD());
                }
View Full Code Here

                        position = raf.getFilePointer();
                        next.setPointer(raf.readInt());
                        next.setSize(raf.readInt());
                        next.setType(raf.readByte());
                        if (type != Location.ANY_RECORD_TYPE && next.getType() != type) {
                            raf.skipBytes(next.getSize() - Journal.HEADER_SIZE);
                        } else {
                            break;
                        }
                    } while (raf.length() - raf.getFilePointer() > Journal.HEADER_SIZE);
                    if (type == Location.ANY_RECORD_TYPE || next.getType() == type) {
View Full Code Here

        xml_os.close();
      }
    }
    RandomAccessFile raf = new RandomAccessFile(filename, "rw");
    try {
      raf.skipBytes(7);
      // int return_val =
      updateElement(raf, handler.countList, 0);
      // Debug.p("Return val: " + return_val);
    } finally {
      raf.close();
View Full Code Here

        // Test for method int java.io.RandomAccessFile.skipBytes(int)
        byte[] buf = new byte[5];
        RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
        raf.writeBytes("HelloWorld");
        raf.seek(0);
        raf.skipBytes(5);
        raf.readFully(buf);
        assertEquals("Failed to skip bytes", "World", new String(buf, 0, 5, "UTF-8"));
        raf.close();
    }
View Full Code Here

        try {
            journal.sync();
            //
            RandomAccessFile raf = getOrCreateRaf(Thread.currentThread(), location.getDataFileId());
            if (seekToLocation(raf, location)) {
                raf.skipBytes(Journal.RECORD_POINTER_SIZE + Journal.RECORD_LENGTH_SIZE);
                raf.write(type);
                location.setType(type);
                if (sync) {
                    IOHelper.sync(raf.getFD());
                }
View Full Code Here

                        position = raf.getFilePointer();
                        next.setPointer(raf.readInt());
                        next.setSize(raf.readInt());
                        next.setType(raf.readByte());
                        if (type != Location.ANY_RECORD_TYPE && next.getType() != type) {
                            raf.skipBytes(next.getSize() - Journal.HEADER_SIZE);
                        } else {
                            break;
                        }
                    } while (raf.length() - raf.getFilePointer() > Journal.HEADER_SIZE);
                    if (type == Location.ANY_RECORD_TYPE || next.getType() == type) {
View Full Code Here

        try {
            journal.sync();
            //
            RandomAccessFile raf = getOrCreateRaf(Thread.currentThread(), location.getDataFileId());
            if (seekToLocation(raf, location)) {
                raf.skipBytes(Journal.RECORD_POINTER_SIZE + Journal.RECORD_LENGTH_SIZE);
                raf.write(type);
                location.setType(type);
                if (sync) {
                    IOHelper.sync(raf.getFD());
                }
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.