private void writeReal(byte[] data) throws IOException { if (this.channel == null) { this.file.write(data); } else { ByteBuffer dst = ByteBuffer.wrap(data); channel.write(dst); } this.fileLength = this.getLength(); }
public byte readByte(long pos) throws IOException { byte[] buf = read(pos, 1); return buf[0]; } public long getOffset(){
private byte[] getReadBlock(long blockNumber) throws IOException { byte[] blockBytes = this.buffer.get(blockNumber); if (blockBytes != null) { if (blockBytes.length == blockSize) return blockBytes; } long pos = blockNumber * blockSize; if(pos >=this.fileLength) return null; this.readAccessCount++; this.seek(pos); long len = Math.min((this.fileLength - pos), blockSize); blockBytes = new byte[(int) len]; readReal(blockBytes); this.buffer.put(blockNumber, blockBytes); return blockBytes; }
public void append(byte[] data) throws IOException { this.write(this.fileLength, data); }
if (posOnBlock > 0) { byte[] blockBytes = getReadBlock(pos / blockSize); if(blockBytes==null){ return null; byte[] blockBytes = getReadBlock(pos / blockSize); if (blockBytes == null) { return out.toByteArray(); byte[] block = getReadBlock(pos / blockSize); if (block != null) { remainder = Math.min(block.length, remainder);
public void append(byte[] data) throws IOException { this.write(this.fileLength, data); }
if (posOnBlock > 0) { byte[] blockBytes = getReadBlock(pos / blockSize); if(blockBytes==null){ return null; byte[] blockBytes = getReadBlock(pos / blockSize); if (blockBytes == null) { return out.toByteArray(); byte[] block = getReadBlock(pos / blockSize); if (block != null) { remainder = Math.min(block.length, remainder);
private byte[] getReadBlock(long blockNumber) throws IOException { byte[] blockBytes = this.buffer.get(blockNumber); if (blockBytes != null) { if (blockBytes.length == blockSize) return blockBytes; } long pos = blockNumber * blockSize; if(pos >=this.fileLength) return null; this.readAccessCount++; this.seek(pos); long len = Math.min((this.fileLength - pos), blockSize); blockBytes = new byte[(int) len]; readReal(blockBytes); this.buffer.put(blockNumber, blockBytes); return blockBytes; }
public byte readByte(long pos) throws IOException { byte[] buf = read(pos, 1); return buf[0]; } public long getOffset(){
public void append(byte[] data) throws IOException { this.write(this.fileLength, data); }
private void writeReal(byte[] data) throws IOException { if (this.channel == null) { this.file.write(data); } else { ByteBuffer dst = ByteBuffer.wrap(data); channel.write(dst); } this.fileLength = this.getLength(); }
if (posOnBlock > 0) { byte[] blockBytes = getReadBlock(pos / blockSize); if(blockBytes==null){ return null; byte[] blockBytes = getReadBlock(pos / blockSize); if (blockBytes == null) { return out.toByteArray(); byte[] block = getReadBlock(pos / blockSize); if (block != null) { remainder = Math.min(block.length, remainder);
private byte[] getReadBlock(long blockNumber) throws IOException { byte[] blockBytes = this.buffer.get(blockNumber); if (blockBytes != null) { if (blockBytes.length == blockSize) return blockBytes; } long pos = blockNumber * blockSize; if(pos >=this.fileLength) return null; this.readAccessCount++; this.seek(pos); long len = Math.min((this.fileLength - pos), blockSize); blockBytes = new byte[(int) len]; readReal(blockBytes); this.buffer.put(blockNumber, blockBytes); return blockBytes; }
public byte readByte(long pos) throws IOException { byte[] buf = read(pos, 1); return buf[0]; } public long getOffset(){
public void append(byte[] data) throws IOException { this.write(this.fileLength, data); }
private void writeReal(byte[] data) throws IOException { if (this.channel == null) { this.file.write(data); } else { ByteBuffer dst = ByteBuffer.wrap(data); channel.write(dst); } this.fileLength = this.getLength(); }