@Override public void write(byte[] b, int off, int len) throws IOException { FileStore.this.write(b, off, len); } };
@Override public void write(byte[] b, int off, int len) throws IOException { FileStore.this.write(b, off, len); } };
@Override public void write(byte[] b, int off, int len) throws IOException { FileStore.this.write(b, off, len); } };
private void writeDirect(byte[] b, int off, int len) throws IOException { FileStore.this.write(b, off, len); bytesWritten = true; }
private void writeDirect(byte[] b, int off, int len) throws IOException { FileStore.this.write(b, off, len); bytesWritten = true; }
private void writeDirect(byte[] b, int off, int len) throws IOException { FileStore.this.write(b, off, len); bytesWritten = true; }
public synchronized void write(byte[] bytes, int offset, int length) throws IOException { write(getLength(), bytes, offset, length); }
public synchronized void write(byte[] bytes, int offset, int length) throws IOException { write(getLength(), bytes, offset, length); }
public synchronized void write(byte[] bytes, int offset, int length) throws IOException { write(getLength(), bytes, offset, length); }
@Override protected int readWrite(long fileOffset, byte[] b, int offSet, int length, boolean write) throws IOException { FileStore store = null; if (!write) { synchronized (this) { if (fileOffset > len) { throw new IOException("Invalid file position " + fileOffset + " length " + length); //$NON-NLS-1$ //$NON-NLS-2$ } store = storageFiles.get((int)(fileOffset/maxFileSize)); } return store.read(fileOffset%maxFileSize, b, offSet, length); } synchronized (this) { ensureLength(fileOffset + length); store = storageFiles.get((int)(fileOffset/maxFileSize)); } long fileBegin = fileOffset%maxFileSize; length = Math.min(length, (int)Math.min(Integer.MAX_VALUE, maxFileSize - fileBegin)); store.write(fileBegin, b, offSet, length); return length; }
@Override protected int readWrite(long fileOffset, byte[] b, int offSet, int length, boolean write) throws IOException { FileStore store = null; if (!write) { synchronized (this) { if (fileOffset > len) { throw new IOException("Invalid file position " + fileOffset + " length " + length); //$NON-NLS-1$ //$NON-NLS-2$ } store = storageFiles.get((int)(fileOffset/maxFileSize)); } return store.read(fileOffset%maxFileSize, b, offSet, length); } synchronized (this) { ensureLength(fileOffset + length); store = storageFiles.get((int)(fileOffset/maxFileSize)); } long fileBegin = fileOffset%maxFileSize; length = Math.min(length, (int)Math.min(Integer.MAX_VALUE, maxFileSize - fileBegin)); store.write(fileBegin, b, offSet, length); return length; }
@Override protected int readWrite(long fileOffset, byte[] b, int offSet, int length, boolean write) throws IOException { FileStore store = null; if (!write) { synchronized (this) { if (fileOffset > len) { throw new IOException("Invalid file position " + fileOffset + " length " + length); //$NON-NLS-1$ //$NON-NLS-2$ } store = storageFiles.get((int)(fileOffset/maxFileSize)); } return store.read(fileOffset%maxFileSize, b, offSet, length); } synchronized (this) { ensureLength(fileOffset + length); store = storageFiles.get((int)(fileOffset/maxFileSize)); } long fileBegin = fileOffset%maxFileSize; length = Math.min(length, (int)Math.min(Integer.MAX_VALUE, maxFileSize - fileBegin)); store.write(fileBegin, b, offSet, length); return length; }
file.write(adjustedfileOffset, buffer, 0, adjustedLength); len = Math.max(len, fileOffset + length); return length;
fs.write(blockOffset, b, 0, read); blockOffset+=read;
@Override public void write(byte[] bytes, int offset, int length) throws IOException { if (maxLength < Long.MAX_VALUE && delegate.getLength() + length > maxLength) { throw new IOException(QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31260, maxLength)); } IOException ex = null; for (int i = 0; i < SESSION_KILLING_RETRIES; i++) { try { delegate.write(bytes, offset, length); updateBytesUsed(length); return; } catch (OutOfDiskException e) { ex = e; if (!killer.killLargestConsumer()) { break; } } } throw ex; }
static byte[] writeBytes(FileStore store, long start) throws IOException { byte[] bytes = new byte[2048]; r.nextBytes(bytes); store.write(start, bytes, 0, bytes.length); byte[] bytesRead = new byte[2048]; store.readFully(start, bytesRead, 0, bytesRead.length); assertTrue(Arrays.equals(bytes, bytesRead)); return bytes; }
fs.write(blockOffset, b, 0, read); blockOffset+=read;
fs.write(blockOffset, b, 0, read); blockOffset+=read;
@Override public void write(byte[] bytes, int offset, int length) throws IOException { if (maxLength < Long.MAX_VALUE && delegate.getLength() + length > maxLength) { throw new IOException(QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31260, maxLength)); } IOException ex = null; for (int i = 0; i < SESSION_KILLING_RETRIES; i++) { try { delegate.write(bytes, offset, length); updateBytesUsed(length); return; } catch (OutOfDiskException e) { ex = e; if (!killer.killLargestConsumer()) { break; } } } throw ex; }
@Test(expected=IOException.class) public void testFileStoreMax() throws Exception { BufferManagerImpl bufferManager = new BufferManagerImpl(); bufferManager.setCache(new MemoryStorageManager() { @Override public long getMaxStorageSpace() { return 640; } }); bufferManager.setMaxActivePlans(20); bufferManager.initialize(); FileStore fs = bufferManager.createFileStore("x"); fs.write(new byte[10], 0, 10); }