/** * @param content The buffer. */ void setContent(final byte[] content) { updateLastModified(); this.content = content; }
/** * @param content The buffer. */ void setContent(final byte[] content) { updateLastModified(); this.content = content; }
/** * @param content The buffer. */ void setContent(final byte[] content) { updateLastModified(); this.content = content; }
/** * @param content The buffer. */ void setContent(final byte[] content) { updateLastModified(); this.content = content; }
/** */ void clear() { this.content = EMPTY; updateLastModified(); this.type = FileType.IMAGINARY; this.children.clear(); this.name = null; }
/** */ void clear() { this.content = EMPTY; updateLastModified(); this.type = FileType.IMAGINARY; this.children.clear(); this.name = null; }
/** */ void clear() { this.content = EMPTY; updateLastModified(); this.type = FileType.IMAGINARY; this.children.clear(); this.name = null; }
/** */ void clear() { this.content = EMPTY; updateLastModified(); this.type = FileType.IMAGINARY; this.children.clear(); this.name = null; }
/** * Resize the buffer * * @param newSize The new buffer size. */ void resize(final long newSize) { // A future implementation may allow longs/multiple buffer/and so on if (newSize > Integer.MAX_VALUE) { throw new IllegalArgumentException( String.format("newSize(%d) > Integer.MAX_VALUE(%d)", newSize, Integer.MAX_VALUE)); } final int resize = (int) newSize; final int size = this.size(); final byte[] newBuf = new byte[resize]; System.arraycopy(this.content, 0, newBuf, 0, Math.min(resize, size)); this.content = newBuf; updateLastModified(); }
/** * Resize the buffer * * @param newSize The new buffer size. */ void resize(final long newSize) { // A future implementation may allow longs/multiple buffer/and so on if (newSize > Integer.MAX_VALUE) { throw new IllegalArgumentException( String.format("newSize(%d) > Integer.MAX_VALUE(%d)", newSize, Integer.MAX_VALUE)); } final int resize = (int) newSize; final int size = this.size(); final byte[] newBuf = new byte[resize]; System.arraycopy(this.content, 0, newBuf, 0, Math.min(resize, size)); this.content = newBuf; updateLastModified(); }
/** * Resize the buffer * * @param newSize The new buffer size. */ void resize(final long newSize) { // A future implementation may allow longs/multiple buffer/and so on if (newSize > Integer.MAX_VALUE) { throw new IllegalArgumentException( String.format("newSize(%d) > Integer.MAX_VALUE(%d)", newSize, Integer.MAX_VALUE)); } final int resize = (int) newSize; final int size = this.size(); final byte[] newBuf = new byte[resize]; System.arraycopy(this.content, 0, newBuf, 0, Math.min(resize, size)); this.content = newBuf; updateLastModified(); }
/** * Resize the buffer * * @param newSize The new buffer size. */ void resize(final long newSize) { // A future implementation may allow longs/multiple buffer/and so on if (newSize > Integer.MAX_VALUE) { throw new IllegalArgumentException(String.format("newSize(%d) > Integer.MAX_VALUE(%d)", newSize, Integer.MAX_VALUE)); } final int resize = (int) newSize; final int size = this.size(); final byte[] newBuf = new byte[resize]; System.arraycopy(this.content, 0, newBuf, 0, Math.min(resize, size)); this.content = newBuf; updateLastModified(); }
/** * Remove a child. * * @param data The file data. * @throws FileSystemException if an error occurs. */ void removeChild(final RamFileData data) throws FileSystemException { if (!this.getType().hasChildren()) { throw new FileSystemException("A child can only be removed from a folder"); } if (!this.children.contains(data)) { throw new FileSystemException("Child not found. " + data); } this.children.remove(data); updateLastModified(); }
/** * Remove a child. * * @param data The file data. * @throws FileSystemException if an error occurs. */ void removeChild(final RamFileData data) throws FileSystemException { if (!this.getType().hasChildren()) { throw new FileSystemException("A child can only be removed from a folder"); } if (!this.children.contains(data)) { throw new FileSystemException("Child not found. " + data); } this.children.remove(data); updateLastModified(); }
/** * Remove a child. * * @param data The file data. * @throws FileSystemException if an error occurs. */ void removeChild(final RamFileData data) throws FileSystemException { if (!this.getType().hasChildren()) { throw new FileSystemException("A child can only be removed from a folder"); } if (!this.children.contains(data)) { throw new FileSystemException("Child not found. " + data); } this.children.remove(data); updateLastModified(); }
/** * Remove a child. * * @param data The file data. * @throws FileSystemException if an error occurs. */ void removeChild(final RamFileData data) throws FileSystemException { if (!this.getType().hasChildren()) { throw new FileSystemException( "A child can only be removed from a folder"); } if (!this.children.contains(data)) { throw new FileSystemException("Child not found. " + data); } this.children.remove(data); updateLastModified(); }
/** * Add a child. * * @param data The file data. * @throws FileSystemException if an error occurs. */ void addChild(final RamFileData data) throws FileSystemException { if (!this.getType().hasChildren()) { throw new FileSystemException("A child can only be added in a folder"); } FileSystemException.requireNonNull(data, "No child can be null"); if (this.children.contains(data)) { throw new FileSystemException("Child already exists. " + data); } this.children.add(data); updateLastModified(); }
/** * Add a child. * * @param data The file data. * @throws FileSystemException if an error occurs. */ void addChild(final RamFileData data) throws FileSystemException { if (!this.getType().hasChildren()) { throw new FileSystemException("A child can only be added in a folder"); } if (data == null) { throw new FileSystemException("No child can be null"); } if (this.children.contains(data)) { throw new FileSystemException("Child already exists. " + data); } this.children.add(data); updateLastModified(); }
/** * Add a child. * * @param data The file data. * @throws FileSystemException if an error occurs. */ void addChild(final RamFileData data) throws FileSystemException { if (!this.getType().hasChildren()) { throw new FileSystemException("A child can only be added in a folder"); } if (data == null) { throw new FileSystemException("No child can be null"); } if (this.children.contains(data)) { throw new FileSystemException("Child already exists. " + data); } this.children.add(data); updateLastModified(); }
/** * Saves a file * * @param file * @throws FileSystemException */ void save(final RamFileObject file) throws FileSystemException { // Validate name if (file.getData().getName() == null) { throw new FileSystemException(new IllegalStateException("The data has no name. " + file)); } // Add to the parent if (file.getName().getDepth() > 0) { final RamFileData parentData = this.cache.get(file.getParent().getName()); // Only if not already added if (!parentData.hasChildren(file.getData())) { final RamFileObject parent = (RamFileObject) file.getParent(); parent.getData().addChild(file.getData()); parent.close(); } } // Store in cache cache.put(file.getName(), file.getData()); file.getData().updateLastModified(); file.close(); }