Package java.io

Examples of java.io.RandomAccessFile.skipBytes()


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


                    result.add(new Record(id, buffer));
                }
                else {
                    int actual = 0;
                    do {
                        actual += raf.skipBytes(entrySize - actual);
                    }
                    while (actual < entrySize);
                }
            }
        }
View Full Code Here

            int dataLength=bytesWritten-waveFileFormat.getHeaderSize();
            int riffLength=dataLength + waveFileFormat.getHeaderSize() - 8;

            RandomAccessFile raf=new RandomAccessFile(out, "rw");
            // skip RIFF magic
            raf.skipBytes(4);
            raf.writeInt(big2little( riffLength ));
            // skip WAVE magic, fmt_ magic, fmt_ length, fmt_ chunk, data magic
            raf.skipBytes(4+4+4+WaveFileFormat.getFmtChunkSize(waveFileFormat.getWaveType())+4);
            raf.writeInt(big2little( dataLength ));
            // that's all
View Full Code Here

            RandomAccessFile raf=new RandomAccessFile(out, "rw");
            // skip RIFF magic
            raf.skipBytes(4);
            raf.writeInt(big2little( riffLength ));
            // skip WAVE magic, fmt_ magic, fmt_ length, fmt_ chunk, data magic
            raf.skipBytes(4+4+4+WaveFileFormat.getFmtChunkSize(waveFileFormat.getWaveType())+4);
            raf.writeInt(big2little( dataLength ));
            // that's all
            raf.close();
        }
View Full Code Here

            long dataSize=ssndChunkSize-16;
            int numFrames=(int) (dataSize*8/ssndBlockSize);

            RandomAccessFile raf=new RandomAccessFile(out, "rw");
            // skip FORM magic
            raf.skipBytes(4);
            raf.writeInt(aiffLength-8);
            // skip aiff2 magic, fver chunk, comm magic, comm size, channel count,
            raf.skipBytes(4+aiffFileFormat.getFverChunkSize()+4+4+2);
            // write frame count
            raf.writeInt(numFrames);
View Full Code Here

            RandomAccessFile raf=new RandomAccessFile(out, "rw");
            // skip FORM magic
            raf.skipBytes(4);
            raf.writeInt(aiffLength-8);
            // skip aiff2 magic, fver chunk, comm magic, comm size, channel count,
            raf.skipBytes(4+aiffFileFormat.getFverChunkSize()+4+4+2);
            // write frame count
            raf.writeInt(numFrames);
            // skip sample size, samplerate, SSND magic
            raf.skipBytes(2+10+4);
            raf.writeInt(ssndChunkSize-8);
View Full Code Here

            // skip aiff2 magic, fver chunk, comm magic, comm size, channel count,
            raf.skipBytes(4+aiffFileFormat.getFverChunkSize()+4+4+2);
            // write frame count
            raf.writeInt(numFrames);
            // skip sample size, samplerate, SSND magic
            raf.skipBytes(2+10+4);
            raf.writeInt(ssndChunkSize-8);
            // that's all
            raf.close();
        }
View Full Code Here

       
        if(writePosition >= SECTOR_SIZE) {
            if(sdImageFile != null) {
                try {
                    RandomAccessFile raf = new RandomAccessFile(sdImageFile, "rw");
                    raf.skipBytes(this.position);
                    raf.write(writeBuffer, 0, writeBuffer.length);
                    raf.close();
                } catch (IOException ex) {
                    logger.log(Level.WARNING, "could not write data back to SD image file!", ex);
                }
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

        // 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

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.