bugged
stringlengths
6
599k
fixed
stringlengths
10
599k
__index_level_0__
int64
0
1.13M
private static final void setInUse(long blockNr, boolean inUse) { // 32-bits per int, so shift=5, mask=31 final long offset = blockNr >>> 5; final int mask = (1 << (int) (blockNr & 31)); final Address ptr = Unsafe.add(bitmapPtr, Unsafe.longToAddress(offset)); int v = Unsafe.getInt(ptr); if (inUse) { v |= mask; } else { v &= ~mask; } Unsafe.setInt(ptr, v); }
private static final void setInUse(long blockNr, boolean inUse) { // 32-bits per int, so shift=5, mask=31 final long offset = blockNr >>> 5; final int mask = (1 << (int) (blockNr & 31)); final Address ptr = Unsafe.add(bitmapPtr, Unsafe.longToAddress(offset)); int v = Unsafe.getByte(ptr); if (inUse) { v |= mask; } else { v &= ~mask; } Unsafe.setInt(ptr, v); }
11,010
private static final void setInUse(long blockNr, boolean inUse) { // 32-bits per int, so shift=5, mask=31 final long offset = blockNr >>> 5; final int mask = (1 << (int) (blockNr & 31)); final Address ptr = Unsafe.add(bitmapPtr, Unsafe.longToAddress(offset)); int v = Unsafe.getInt(ptr); if (inUse) { v |= mask; } else { v &= ~mask; } Unsafe.setInt(ptr, v); }
private static final void setInUse(long blockNr, boolean inUse) { // 32-bits per int, so shift=5, mask=31 final long offset = blockNr >>> 5; final int mask = (1 << (int) (blockNr & 31)); final Address ptr = Unsafe.add(bitmapPtr, Unsafe.longToAddress(offset)); int v = Unsafe.getInt(ptr); if (inUse) { v |= mask; } else { v &= ~mask; } Unsafe.setByte(ptr, (byte)v); }
11,011
public final boolean isOpen () { return opened; }
public final boolean isOpen () { return ! closed; }
11,013
public abstract SelectionKey register (Selector sel, int ops, Object att) throws ClosedChannelException;
public abstract SelectionKey register (Selector sel, int ops, Object att) throws ClosedChannelException;
11,014
public Ext2FileSystem(Device device) throws FileSystemException { if (device == null) { throw new FileSystemException("null device!"); } this.device = device; try { this.api = (FSBlockDeviceAPI) device.getAPI(FSBlockDeviceAPI.class); } catch (ApiNotFoundException ex) { throw new FileSystemException("Device is not a partition", ex); } closed = false; byte data[]; //points to the byte where the fs metadata parsing has reached long byteIndex; cache = new BlockCache(50, (float) 0.75); try { data = new byte[Superblock.SUPERBLOCK_LENGTH]; //skip the first 1024 bytes (bootsector) and read the superblock byteIndex = 1024; api.read(byteIndex, data, 0, Superblock.SUPERBLOCK_LENGTH); byteIndex += Superblock.SUPERBLOCK_LENGTH; superblock = new Superblock(data); //read the group descriptors groupCount = (int) Math.ceil((double) superblock.getBlocksCount() / (double) superblock.getBlocksPerGroup()); groupDescriptors = new GroupDescriptor[groupCount]; for (int i = 0; i < groupCount; i++) { data = new byte[GroupDescriptor.GROUPDESCRIPTOR_LENGTH]; api.read(byteIndex + i * GroupDescriptor.GROUPDESCRIPTOR_LENGTH, data, 0, GroupDescriptor.GROUPDESCRIPTOR_LENGTH); groupDescriptors[i] = new GroupDescriptor(data); } byteIndex += superblock.getBlockSize(); /* * //go through each block group //XXX byteIndex = ... //read the block bitmap //XXX what if it doesn't fit? data = new byte[(int)superblock.getBlockSize()]; api.read( byteIndex, data, 0, * (int)superblock.getBlockSize()); FSBitmap blockBitmap = new FSBitmap(data); byteIndex += superblock.getBlockSize(); * * //read the inode bitmap //XXX what if it doesn't fit? data = new byte[(int)superblock.getBlockSize()]; api.read( byteIndex, data, 0, (int)superblock.getBlockSize()); FSBitmap * inodeBitmap = new FSBitmap(data); byteIndex += superblock.getBlockSize(); * * //read the inode table //XXX what if it doesn't fit? Inode inodeTable[] = new Inode[ (int)superblock.getInodesCount() ]; */ } catch (FileSystemException e) { throw e; } catch (Exception e) { throw new FileSystemException(e); } log.debug("Ext2fs filesystem constructed sucessfully"); log.debug( " superblock: #blocks: " + superblock.getBlocksCount() + "\n" + " #blocks/group: " + superblock.getBlocksPerGroup() + "\n" + " #block groups: " + groupCount + "\n" + " block size: " + superblock.getBlockSize() + "\n" + " #inodes: " + superblock.getINodesCount() + "\n" + " #inodes/group: " + superblock.getINodesPerGroup()); }
public Ext2FileSystem(Device device) throws FileSystemException { if (device == null) { throw new FileSystemException("null device!"); } this.device = device; try { this.api = (FSBlockDeviceAPI) device.getAPI(FSBlockDeviceAPI.class); } catch (ApiNotFoundException ex) { throw new FileSystemException("Device is not a partition", ex); } closed = false; byte data[]; //points to the byte where the fs metadata parsing has reached long byteIndex; cache = new BlockCache(50, (float) 0.75); try { data = new byte[Superblock.SUPERBLOCK_LENGTH]; //skip the first 1024 bytes (bootsector) and read the superblock byteIndex = 1024; api.read(byteIndex, data, 0, Superblock.SUPERBLOCK_LENGTH); byteIndex += Superblock.SUPERBLOCK_LENGTH; superblock = new Superblock(data); //read the group descriptors groupCount = (int) Math.ceil((double) superblock.getBlocksCount() / (double) superblock.getBlocksPerGroup()); groupDescriptors = new GroupDescriptor[groupCount]; for (int i = 0; i < groupCount; i++) { data = new byte[GroupDescriptor.GROUPDESCRIPTOR_LENGTH]; api.read(byteIndex + i * GroupDescriptor.GROUPDESCRIPTOR_LENGTH, data, 0, GroupDescriptor.GROUPDESCRIPTOR_LENGTH); groupDescriptors[i] = new GroupDescriptor(data); } byteIndex += superblock.getBlockSize(); /* * //go through each block group //XXX byteIndex = ... //read the block bitmap //XXX what if it doesn't fit? data = new byte[(int)superblock.getBlockSize()]; api.read( byteIndex, data, 0, * (int)superblock.getBlockSize()); FSBitmap blockBitmap = new FSBitmap(data); byteIndex += superblock.getBlockSize(); * * //read the inode bitmap //XXX what if it doesn't fit? data = new byte[(int)superblock.getBlockSize()]; api.read( byteIndex, data, 0, (int)superblock.getBlockSize()); FSBitmap * inodeBitmap = new FSBitmap(data); byteIndex += superblock.getBlockSize(); * * //read the inode table //XXX what if it doesn't fit? Inode inodeTable[] = new Inode[ (int)superblock.getInodesCount() ]; */ } catch (FileSystemException e) { throw e; } catch (Exception e) { throw new FileSystemException(e); } log.debug("Ext2fs filesystem constructed sucessfully"); log.debug( " superblock: #blocks: " + superblock.getBlocksCount() + "\n" + " #blocks/group: " + superblock.getBlocksPerGroup() + "\n" + " #block groups: " + groupCount + "\n" + " block size: " + superblock.getBlockSize() + "\n" + " #inodes: " + superblock.getINodesCount() + "\n" + " #inodes/group: " + superblock.getINodesPerGroup()); }
11,015
public Ext2FileSystem(Device device) throws FileSystemException { if (device == null) { throw new FileSystemException("null device!"); } this.device = device; try { this.api = (FSBlockDeviceAPI) device.getAPI(FSBlockDeviceAPI.class); } catch (ApiNotFoundException ex) { throw new FileSystemException("Device is not a partition", ex); } closed = false; byte data[]; //points to the byte where the fs metadata parsing has reached long byteIndex; cache = new BlockCache(50, (float) 0.75); try { data = new byte[Superblock.SUPERBLOCK_LENGTH]; //skip the first 1024 bytes (bootsector) and read the superblock byteIndex = 1024; api.read(byteIndex, data, 0, Superblock.SUPERBLOCK_LENGTH); byteIndex += Superblock.SUPERBLOCK_LENGTH; superblock = new Superblock(data); //read the group descriptors groupCount = (int) Math.ceil((double) superblock.getBlocksCount() / (double) superblock.getBlocksPerGroup()); groupDescriptors = new GroupDescriptor[groupCount]; for (int i = 0; i < groupCount; i++) { data = new byte[GroupDescriptor.GROUPDESCRIPTOR_LENGTH]; api.read(byteIndex + i * GroupDescriptor.GROUPDESCRIPTOR_LENGTH, data, 0, GroupDescriptor.GROUPDESCRIPTOR_LENGTH); groupDescriptors[i] = new GroupDescriptor(data); } byteIndex += superblock.getBlockSize(); /* * //go through each block group //XXX byteIndex = ... //read the block bitmap //XXX what if it doesn't fit? data = new byte[(int)superblock.getBlockSize()]; api.read( byteIndex, data, 0, * (int)superblock.getBlockSize()); FSBitmap blockBitmap = new FSBitmap(data); byteIndex += superblock.getBlockSize(); * * //read the inode bitmap //XXX what if it doesn't fit? data = new byte[(int)superblock.getBlockSize()]; api.read( byteIndex, data, 0, (int)superblock.getBlockSize()); FSBitmap * inodeBitmap = new FSBitmap(data); byteIndex += superblock.getBlockSize(); * * //read the inode table //XXX what if it doesn't fit? Inode inodeTable[] = new Inode[ (int)superblock.getInodesCount() ]; */ } catch (FileSystemException e) { throw e; } catch (Exception e) { throw new FileSystemException(e); } log.debug("Ext2fs filesystem constructed sucessfully"); log.debug( " superblock: #blocks: " + superblock.getBlocksCount() + "\n" + " #blocks/group: " + superblock.getBlocksPerGroup() + "\n" + " #block groups: " + groupCount + "\n" + " block size: " + superblock.getBlockSize() + "\n" + " #inodes: " + superblock.getINodesCount() + "\n" + " #inodes/group: " + superblock.getINodesPerGroup()); }
public Ext2FileSystem(Device device) throws FileSystemException { if (device == null) { throw new FileSystemException("null device!"); this.device = device; try { this.api = (FSBlockDeviceAPI) device.getAPI(FSBlockDeviceAPI.class); catch (ApiNotFoundException ex) { throw new FileSystemException("Device is not a partition", ex); closed = false; byte data[]; //points to the byte where the fs metadata parsing has reached long byteIndex; cache = new BlockCache(50, (float) 0.75); try { data = new byte[Superblock.SUPERBLOCK_LENGTH]; //skip the first 1024 bytes (bootsector) and read the superblock byteIndex = 1024; api.read(byteIndex, data, 0, Superblock.SUPERBLOCK_LENGTH); byteIndex += Superblock.SUPERBLOCK_LENGTH; superblock = new Superblock(data); //read the group descriptors groupCount = (int) Math.ceil((double) superblock.getBlocksCount() / (double) superblock.getBlocksPerGroup()); groupDescriptors = new GroupDescriptor[groupCount]; for (int i = 0; i < groupCount; i++) { data = new byte[GroupDescriptor.GROUPDESCRIPTOR_LENGTH]; api.read(byteIndex + i * GroupDescriptor.GROUPDESCRIPTOR_LENGTH, data, 0, GroupDescriptor.GROUPDESCRIPTOR_LENGTH); groupDescriptors[i] = new GroupDescriptor(data); byteIndex += superblock.getBlockSize(); /* * //go through each block group //XXX byteIndex = ... //read the block bitmap //XXX what if it doesn't fit? data = new byte[(int)superblock.getBlockSize()]; api.read( byteIndex, data, 0, * (int)superblock.getBlockSize()); FSBitmap blockBitmap = new FSBitmap(data); byteIndex += superblock.getBlockSize(); * * //read the inode bitmap //XXX what if it doesn't fit? data = new byte[(int)superblock.getBlockSize()]; api.read( byteIndex, data, 0, (int)superblock.getBlockSize()); FSBitmap * inodeBitmap = new FSBitmap(data); byteIndex += superblock.getBlockSize(); * * //read the inode table //XXX what if it doesn't fit? Inode inodeTable[] = new Inode[ (int)superblock.getInodesCount() ]; */ catch (FileSystemException e) { throw e; catch (Exception e) { throw new FileSystemException(e); log.debug("Ext2fs filesystem constructed sucessfully"); log.debug( " superblock: #blocks: " + superblock.getBlocksCount() + "\n" + " #blocks/group: " + superblock.getBlocksPerGroup() + "\n" + " #block groups: " + groupCount + "\n" + " block size: " + superblock.getBlockSize() + "\n" + " #inodes: " + superblock.getINodesCount() + "\n" + " #inodes/group: " + superblock.getINodesPerGroup());
11,016
public Ext2FileSystem(Device device) throws FileSystemException { if (device == null) { throw new FileSystemException("null device!"); } this.device = device; try { this.api = (FSBlockDeviceAPI) device.getAPI(FSBlockDeviceAPI.class); } catch (ApiNotFoundException ex) { throw new FileSystemException("Device is not a partition", ex); } closed = false; byte data[]; //points to the byte where the fs metadata parsing has reached long byteIndex; cache = new BlockCache(50, (float) 0.75); try { data = new byte[Superblock.SUPERBLOCK_LENGTH]; //skip the first 1024 bytes (bootsector) and read the superblock byteIndex = 1024; api.read(byteIndex, data, 0, Superblock.SUPERBLOCK_LENGTH); byteIndex += Superblock.SUPERBLOCK_LENGTH; superblock = new Superblock(data); //read the group descriptors groupCount = (int) Math.ceil((double) superblock.getBlocksCount() / (double) superblock.getBlocksPerGroup()); groupDescriptors = new GroupDescriptor[groupCount]; for (int i = 0; i < groupCount; i++) { data = new byte[GroupDescriptor.GROUPDESCRIPTOR_LENGTH]; api.read(byteIndex + i * GroupDescriptor.GROUPDESCRIPTOR_LENGTH, data, 0, GroupDescriptor.GROUPDESCRIPTOR_LENGTH); groupDescriptors[i] = new GroupDescriptor(data); } byteIndex += superblock.getBlockSize(); /* * //go through each block group //XXX byteIndex = ... //read the block bitmap //XXX what if it doesn't fit? data = new byte[(int)superblock.getBlockSize()]; api.read( byteIndex, data, 0, * (int)superblock.getBlockSize()); FSBitmap blockBitmap = new FSBitmap(data); byteIndex += superblock.getBlockSize(); * * //read the inode bitmap //XXX what if it doesn't fit? data = new byte[(int)superblock.getBlockSize()]; api.read( byteIndex, data, 0, (int)superblock.getBlockSize()); FSBitmap * inodeBitmap = new FSBitmap(data); byteIndex += superblock.getBlockSize(); * * //read the inode table //XXX what if it doesn't fit? Inode inodeTable[] = new Inode[ (int)superblock.getInodesCount() ]; */ } catch (FileSystemException e) { throw e; } catch (Exception e) { throw new FileSystemException(e); } log.debug("Ext2fs filesystem constructed sucessfully"); log.debug( " superblock: #blocks: " + superblock.getBlocksCount() + "\n" + " #blocks/group: " + superblock.getBlocksPerGroup() + "\n" + " #block groups: " + groupCount + "\n" + " block size: " + superblock.getBlockSize() + "\n" + " #inodes: " + superblock.getINodesCount() + "\n" + " #inodes/group: " + superblock.getINodesPerGroup()); }
public Ext2FileSystem(Device device) throws FileSystemException { if (device == null) { throw new FileSystemException("null device!"); } this.device = device; try { this.api = (FSBlockDeviceAPI) device.getAPI(FSBlockDeviceAPI.class); } catch (ApiNotFoundException ex) { throw new FileSystemException("Device is not a partition", ex); } closed = false; byte data[]; //points to the byte where the fs metadata parsing has reached long byteIndex; cache = new BlockCache(50, (float) 0.75); try { data = new byte[Superblock.SUPERBLOCK_LENGTH]; //skip the first 1024 bytes (bootsector) and read the superblock byteIndex = 1024; api.read(byteIndex, data, 0, Superblock.SUPERBLOCK_LENGTH); byteIndex += Superblock.SUPERBLOCK_LENGTH; superblock = new Superblock(data); //read the group descriptors groupCount = (int) Math.ceil((double) superblock.getBlocksCount() / (double) superblock.getBlocksPerGroup()); groupDescriptors = new GroupDescriptor[groupCount]; for (int i = 0; i < groupCount; i++) { data = new byte[GroupDescriptor.GROUPDESCRIPTOR_LENGTH]; api.read(byteIndex + i * GroupDescriptor.GROUPDESCRIPTOR_LENGTH, data, 0, GroupDescriptor.GROUPDESCRIPTOR_LENGTH); groupDescriptors[i] = new GroupDescriptor(data); } byteIndex += superblock.getBlockSize(); /* * //go through each block group //XXX byteIndex = ... //read the block bitmap //XXX what if it doesn't fit? data = new byte[(int)superblock.getBlockSize()]; api.read( byteIndex, data, 0, * (int)superblock.getBlockSize()); FSBitmap blockBitmap = new FSBitmap(data); byteIndex += superblock.getBlockSize(); * * //read the inode bitmap //XXX what if it doesn't fit? data = new byte[(int)superblock.getBlockSize()]; api.read( byteIndex, data, 0, (int)superblock.getBlockSize()); FSBitmap * inodeBitmap = new FSBitmap(data); byteIndex += superblock.getBlockSize(); * * //read the inode table //XXX what if it doesn't fit? Inode inodeTable[] = new Inode[ (int)superblock.getInodesCount() ]; */ } catch (FileSystemException e) { throw e; } catch (Exception e) { throw new FileSystemException(e); } log.debug("Ext2fs filesystem constructed sucessfully"); log.debug( " superblock: #blocks: " + superblock.getBlocksCount() + "\n" + " #blocks/group: " + superblock.getBlocksPerGroup() + "\n" + " #block groups: " + groupCount + "\n" + " block size: " + superblock.getBlockSize() + "\n" + " #inodes: " + superblock.getINodesCount() + "\n" + " #inodes/group: " + superblock.getINodesPerGroup()); }
11,017
public Ext2FileSystem(Device device) throws FileSystemException { if (device == null) { throw new FileSystemException("null device!"); } this.device = device; try { this.api = (FSBlockDeviceAPI) device.getAPI(FSBlockDeviceAPI.class); } catch (ApiNotFoundException ex) { throw new FileSystemException("Device is not a partition", ex); } closed = false; byte data[]; //points to the byte where the fs metadata parsing has reached long byteIndex; cache = new BlockCache(50, (float) 0.75); try { data = new byte[Superblock.SUPERBLOCK_LENGTH]; //skip the first 1024 bytes (bootsector) and read the superblock byteIndex = 1024; api.read(byteIndex, data, 0, Superblock.SUPERBLOCK_LENGTH); byteIndex += Superblock.SUPERBLOCK_LENGTH; superblock = new Superblock(data); //read the group descriptors groupCount = (int) Math.ceil((double) superblock.getBlocksCount() / (double) superblock.getBlocksPerGroup()); groupDescriptors = new GroupDescriptor[groupCount]; for (int i = 0; i < groupCount; i++) { data = new byte[GroupDescriptor.GROUPDESCRIPTOR_LENGTH]; api.read(byteIndex + i * GroupDescriptor.GROUPDESCRIPTOR_LENGTH, data, 0, GroupDescriptor.GROUPDESCRIPTOR_LENGTH); groupDescriptors[i] = new GroupDescriptor(data); } byteIndex += superblock.getBlockSize(); /* * //go through each block group //XXX byteIndex = ... //read the block bitmap //XXX what if it doesn't fit? data = new byte[(int)superblock.getBlockSize()]; api.read( byteIndex, data, 0, * (int)superblock.getBlockSize()); FSBitmap blockBitmap = new FSBitmap(data); byteIndex += superblock.getBlockSize(); * * //read the inode bitmap //XXX what if it doesn't fit? data = new byte[(int)superblock.getBlockSize()]; api.read( byteIndex, data, 0, (int)superblock.getBlockSize()); FSBitmap * inodeBitmap = new FSBitmap(data); byteIndex += superblock.getBlockSize(); * * //read the inode table //XXX what if it doesn't fit? Inode inodeTable[] = new Inode[ (int)superblock.getInodesCount() ]; */ } catch (FileSystemException e) { throw e; } catch (Exception e) { throw new FileSystemException(e); } log.debug("Ext2fs filesystem constructed sucessfully"); log.debug( " superblock: #blocks: " + superblock.getBlocksCount() + "\n" + " #blocks/group: " + superblock.getBlocksPerGroup() + "\n" + " #block groups: " + groupCount + "\n" + " block size: " + superblock.getBlockSize() + "\n" + " #inodes: " + superblock.getINodesCount() + "\n" + " #inodes/group: " + superblock.getINodesPerGroup()); }
public Ext2FileSystem(Device device) throws FileSystemException { if (device == null) { throw new FileSystemException("null device!"); } this.device = device; try { this.api = (FSBlockDeviceAPI) device.getAPI(FSBlockDeviceAPI.class); } catch (ApiNotFoundException ex) { throw new FileSystemException("Device is not a partition", ex); } closed = false; byte data[]; //points to the byte where the fs metadata parsing has reached blockCache = new BlockCache(50,(float)0.75); inodeCache = new INodeCache(50,(float)0.75); groupDescriptorLock = new Object(); superblockLock = new Object(); cache = new BlockCache(50, (float) 0.75); try { data = new byte[Superblock.SUPERBLOCK_LENGTH]; //skip the first 1024 bytes (bootsector) and read the superblock byteIndex = 1024; api.read(byteIndex, data, 0, Superblock.SUPERBLOCK_LENGTH); byteIndex += Superblock.SUPERBLOCK_LENGTH; superblock = new Superblock(data); //read the group descriptors groupCount = (int) Math.ceil((double) superblock.getBlocksCount() / (double) superblock.getBlocksPerGroup()); groupDescriptors = new GroupDescriptor[groupCount]; for (int i = 0; i < groupCount; i++) { data = new byte[GroupDescriptor.GROUPDESCRIPTOR_LENGTH]; api.read(byteIndex + i * GroupDescriptor.GROUPDESCRIPTOR_LENGTH, data, 0, GroupDescriptor.GROUPDESCRIPTOR_LENGTH); groupDescriptors[i] = new GroupDescriptor(data); } byteIndex += superblock.getBlockSize(); /* * //go through each block group //XXX byteIndex = ... //read the block bitmap //XXX what if it doesn't fit? data = new byte[(int)superblock.getBlockSize()]; api.read( byteIndex, data, 0, * (int)superblock.getBlockSize()); FSBitmap blockBitmap = new FSBitmap(data); byteIndex += superblock.getBlockSize(); * * //read the inode bitmap //XXX what if it doesn't fit? data = new byte[(int)superblock.getBlockSize()]; api.read( byteIndex, data, 0, (int)superblock.getBlockSize()); FSBitmap * inodeBitmap = new FSBitmap(data); byteIndex += superblock.getBlockSize(); * * //read the inode table //XXX what if it doesn't fit? Inode inodeTable[] = new Inode[ (int)superblock.getInodesCount() ]; */ } catch (FileSystemException e) { throw e; } catch (Exception e) { throw new FileSystemException(e); } log.debug("Ext2fs filesystem constructed sucessfully"); log.debug( " superblock: #blocks: " + superblock.getBlocksCount() + "\n" + " #blocks/group: " + superblock.getBlocksPerGroup() + "\n" + " #block groups: " + groupCount + "\n" + " block size: " + superblock.getBlockSize() + "\n" + " #inodes: " + superblock.getINodesCount() + "\n" + " #inodes/group: " + superblock.getINodesPerGroup()); }
11,018
public Ext2FileSystem(Device device) throws FileSystemException { if (device == null) { throw new FileSystemException("null device!"); } this.device = device; try { this.api = (FSBlockDeviceAPI) device.getAPI(FSBlockDeviceAPI.class); } catch (ApiNotFoundException ex) { throw new FileSystemException("Device is not a partition", ex); } closed = false; byte data[]; //points to the byte where the fs metadata parsing has reached long byteIndex; cache = new BlockCache(50, (float) 0.75); try { data = new byte[Superblock.SUPERBLOCK_LENGTH]; //skip the first 1024 bytes (bootsector) and read the superblock byteIndex = 1024; api.read(byteIndex, data, 0, Superblock.SUPERBLOCK_LENGTH); byteIndex += Superblock.SUPERBLOCK_LENGTH; superblock = new Superblock(data); //read the group descriptors groupCount = (int) Math.ceil((double) superblock.getBlocksCount() / (double) superblock.getBlocksPerGroup()); groupDescriptors = new GroupDescriptor[groupCount]; for (int i = 0; i < groupCount; i++) { data = new byte[GroupDescriptor.GROUPDESCRIPTOR_LENGTH]; api.read(byteIndex + i * GroupDescriptor.GROUPDESCRIPTOR_LENGTH, data, 0, GroupDescriptor.GROUPDESCRIPTOR_LENGTH); groupDescriptors[i] = new GroupDescriptor(data); } byteIndex += superblock.getBlockSize(); /* * //go through each block group //XXX byteIndex = ... //read the block bitmap //XXX what if it doesn't fit? data = new byte[(int)superblock.getBlockSize()]; api.read( byteIndex, data, 0, * (int)superblock.getBlockSize()); FSBitmap blockBitmap = new FSBitmap(data); byteIndex += superblock.getBlockSize(); * * //read the inode bitmap //XXX what if it doesn't fit? data = new byte[(int)superblock.getBlockSize()]; api.read( byteIndex, data, 0, (int)superblock.getBlockSize()); FSBitmap * inodeBitmap = new FSBitmap(data); byteIndex += superblock.getBlockSize(); * * //read the inode table //XXX what if it doesn't fit? Inode inodeTable[] = new Inode[ (int)superblock.getInodesCount() ]; */ } catch (FileSystemException e) { throw e; } catch (Exception e) { throw new FileSystemException(e); } log.debug("Ext2fs filesystem constructed sucessfully"); log.debug( " superblock: #blocks: " + superblock.getBlocksCount() + "\n" + " #blocks/group: " + superblock.getBlocksPerGroup() + "\n" + " #block groups: " + groupCount + "\n" + " block size: " + superblock.getBlockSize() + "\n" + " #inodes: " + superblock.getINodesCount() + "\n" + " #inodes/group: " + superblock.getINodesPerGroup()); }
public Ext2FileSystem(Device device) throws FileSystemException { if (device == null) { throw new FileSystemException("null device!"); } this.device = device; try { this.api = (FSBlockDeviceAPI) device.getAPI(FSBlockDeviceAPI.class); } catch (ApiNotFoundException ex) { throw new FileSystemException("Device is not a partition", ex); } closed = false; byte data[]; //points to the byte where the fs metadata parsing has reached long byteIndex; setMode(RW); try{ api = (FSBlockDeviceAPI) device.getAPI(FSBlockDeviceAPI.class); }catch(ApiNotFoundException e) { throw new FileSystemException("Device is not a partition!"); } try { data = new byte[Superblock.SUPERBLOCK_LENGTH]; //skip the first 1024 bytes (bootsector) and read the superblock byteIndex = 1024; api.read(byteIndex, data, 0, Superblock.SUPERBLOCK_LENGTH); byteIndex += Superblock.SUPERBLOCK_LENGTH; superblock = new Superblock(data); //read the group descriptors groupCount = (int) Math.ceil((double) superblock.getBlocksCount() / (double) superblock.getBlocksPerGroup()); groupDescriptors = new GroupDescriptor[groupCount]; for (int i = 0; i < groupCount; i++) { data = new byte[GroupDescriptor.GROUPDESCRIPTOR_LENGTH]; api.read(byteIndex + i * GroupDescriptor.GROUPDESCRIPTOR_LENGTH, data, 0, GroupDescriptor.GROUPDESCRIPTOR_LENGTH); groupDescriptors[i] = new GroupDescriptor(data); } byteIndex += superblock.getBlockSize(); /* * //go through each block group //XXX byteIndex = ... //read the block bitmap //XXX what if it doesn't fit? data = new byte[(int)superblock.getBlockSize()]; api.read( byteIndex, data, 0, * (int)superblock.getBlockSize()); FSBitmap blockBitmap = new FSBitmap(data); byteIndex += superblock.getBlockSize(); * * //read the inode bitmap //XXX what if it doesn't fit? data = new byte[(int)superblock.getBlockSize()]; api.read( byteIndex, data, 0, (int)superblock.getBlockSize()); FSBitmap * inodeBitmap = new FSBitmap(data); byteIndex += superblock.getBlockSize(); * * //read the inode table //XXX what if it doesn't fit? Inode inodeTable[] = new Inode[ (int)superblock.getInodesCount() ]; */ } catch (FileSystemException e) { throw e; } catch (Exception e) { throw new FileSystemException(e); } log.debug("Ext2fs filesystem constructed sucessfully"); log.debug( " superblock: #blocks: " + superblock.getBlocksCount() + "\n" + " #blocks/group: " + superblock.getBlocksPerGroup() + "\n" + " #block groups: " + groupCount + "\n" + " block size: " + superblock.getBlockSize() + "\n" + " #inodes: " + superblock.getINodesCount() + "\n" + " #inodes/group: " + superblock.getINodesPerGroup()); }
11,019
public Ext2FileSystem(Device device) throws FileSystemException { if (device == null) { throw new FileSystemException("null device!"); } this.device = device; try { this.api = (FSBlockDeviceAPI) device.getAPI(FSBlockDeviceAPI.class); } catch (ApiNotFoundException ex) { throw new FileSystemException("Device is not a partition", ex); } closed = false; byte data[]; //points to the byte where the fs metadata parsing has reached long byteIndex; cache = new BlockCache(50, (float) 0.75); try { data = new byte[Superblock.SUPERBLOCK_LENGTH]; //skip the first 1024 bytes (bootsector) and read the superblock byteIndex = 1024; api.read(byteIndex, data, 0, Superblock.SUPERBLOCK_LENGTH); byteIndex += Superblock.SUPERBLOCK_LENGTH; superblock = new Superblock(data); //read the group descriptors groupCount = (int) Math.ceil((double) superblock.getBlocksCount() / (double) superblock.getBlocksPerGroup()); groupDescriptors = new GroupDescriptor[groupCount]; for (int i = 0; i < groupCount; i++) { data = new byte[GroupDescriptor.GROUPDESCRIPTOR_LENGTH]; api.read(byteIndex + i * GroupDescriptor.GROUPDESCRIPTOR_LENGTH, data, 0, GroupDescriptor.GROUPDESCRIPTOR_LENGTH); groupDescriptors[i] = new GroupDescriptor(data); } byteIndex += superblock.getBlockSize(); /* * //go through each block group //XXX byteIndex = ... //read the block bitmap //XXX what if it doesn't fit? data = new byte[(int)superblock.getBlockSize()]; api.read( byteIndex, data, 0, * (int)superblock.getBlockSize()); FSBitmap blockBitmap = new FSBitmap(data); byteIndex += superblock.getBlockSize(); * * //read the inode bitmap //XXX what if it doesn't fit? data = new byte[(int)superblock.getBlockSize()]; api.read( byteIndex, data, 0, (int)superblock.getBlockSize()); FSBitmap * inodeBitmap = new FSBitmap(data); byteIndex += superblock.getBlockSize(); * * //read the inode table //XXX what if it doesn't fit? Inode inodeTable[] = new Inode[ (int)superblock.getInodesCount() ]; */ } catch (FileSystemException e) { throw e; } catch (Exception e) { throw new FileSystemException(e); } log.debug("Ext2fs filesystem constructed sucessfully"); log.debug( " superblock: #blocks: " + superblock.getBlocksCount() + "\n" + " #blocks/group: " + superblock.getBlocksPerGroup() + "\n" + " #block groups: " + groupCount + "\n" + " block size: " + superblock.getBlockSize() + "\n" + " #inodes: " + superblock.getINodesCount() + "\n" + " #inodes/group: " + superblock.getINodesPerGroup()); }
public Ext2FileSystem(Device device) throws FileSystemException { if (device == null) { throw new FileSystemException("null device!"); } this.device = device; try { this.api = (FSBlockDeviceAPI) device.getAPI(FSBlockDeviceAPI.class); } catch (ApiNotFoundException ex) { throw new FileSystemException("Device is not a partition", ex); } closed = false; byte data[]; //points to the byte where the fs metadata parsing has reached long byteIndex; cache = new BlockCache(50, (float) 0.75); try { data = new byte[Superblock.SUPERBLOCK_LENGTH]; //skip the first 1024 bytes (bootsector) and read the superblock byteIndex = 1024; api.read(byteIndex, data, 0, Superblock.SUPERBLOCK_LENGTH); byteIndex += Superblock.SUPERBLOCK_LENGTH; superblock = new Superblock(data); //read the group descriptors groupCount = (int) Math.ceil((double) superblock.getBlocksCount() / (double) superblock.getBlocksPerGroup()); groupDescriptors = new GroupDescriptor[groupCount]; for (int i = 0; i < groupCount; i++) { data = new byte[GroupDescriptor.GROUPDESCRIPTOR_LENGTH]; api.read(byteIndex + i * GroupDescriptor.GROUPDESCRIPTOR_LENGTH, data, 0, GroupDescriptor.GROUPDESCRIPTOR_LENGTH); groupDescriptors[i] = new GroupDescriptor(data); } byteIndex += superblock.getBlockSize(); /* * //go through each block group //XXX byteIndex = ... //read the block bitmap //XXX what if it doesn't fit? data = new byte[(int)superblock.getBlockSize()]; api.read( byteIndex, data, 0, * (int)superblock.getBlockSize()); FSBitmap blockBitmap = new FSBitmap(data); byteIndex += superblock.getBlockSize(); * * //read the inode bitmap //XXX what if it doesn't fit? data = new byte[(int)superblock.getBlockSize()]; api.read( byteIndex, data, 0, (int)superblock.getBlockSize()); FSBitmap * inodeBitmap = new FSBitmap(data); byteIndex += superblock.getBlockSize(); * * //read the inode table //XXX what if it doesn't fit? Inode inodeTable[] = new Inode[ (int)superblock.getInodesCount() ]; */ } catch (FileSystemException e) { throw e; } catch (Exception e) { throw new FileSystemException(e); } log.debug("Ext2fs filesystem constructed sucessfully"); log.debug( " superblock: #blocks: " + superblock.getBlocksCount() + "\n" + " #blocks/group: " + superblock.getBlocksPerGroup() + "\n" + " #block groups: " + groupCount + "\n" + " block size: " + superblock.getBlockSize() + "\n" + " #inodes: " + superblock.getINodesCount() + "\n" + " #inodes/group: " + superblock.getINodesPerGroup()); }
11,020
public Ext2FileSystem(Device device) throws FileSystemException { if (device == null) { throw new FileSystemException("null device!"); } this.device = device; try { this.api = (FSBlockDeviceAPI) device.getAPI(FSBlockDeviceAPI.class); } catch (ApiNotFoundException ex) { throw new FileSystemException("Device is not a partition", ex); } closed = false; byte data[]; //points to the byte where the fs metadata parsing has reached long byteIndex; cache = new BlockCache(50, (float) 0.75); try { data = new byte[Superblock.SUPERBLOCK_LENGTH]; //skip the first 1024 bytes (bootsector) and read the superblock byteIndex = 1024; api.read(byteIndex, data, 0, Superblock.SUPERBLOCK_LENGTH); byteIndex += Superblock.SUPERBLOCK_LENGTH; superblock = new Superblock(data); //read the group descriptors groupCount = (int) Math.ceil((double) superblock.getBlocksCount() / (double) superblock.getBlocksPerGroup()); groupDescriptors = new GroupDescriptor[groupCount]; for (int i = 0; i < groupCount; i++) { data = new byte[GroupDescriptor.GROUPDESCRIPTOR_LENGTH]; api.read(byteIndex + i * GroupDescriptor.GROUPDESCRIPTOR_LENGTH, data, 0, GroupDescriptor.GROUPDESCRIPTOR_LENGTH); groupDescriptors[i] = new GroupDescriptor(data); } byteIndex += superblock.getBlockSize(); /* * //go through each block group //XXX byteIndex = ... //read the block bitmap //XXX what if it doesn't fit? data = new byte[(int)superblock.getBlockSize()]; api.read( byteIndex, data, 0, * (int)superblock.getBlockSize()); FSBitmap blockBitmap = new FSBitmap(data); byteIndex += superblock.getBlockSize(); * * //read the inode bitmap //XXX what if it doesn't fit? data = new byte[(int)superblock.getBlockSize()]; api.read( byteIndex, data, 0, (int)superblock.getBlockSize()); FSBitmap * inodeBitmap = new FSBitmap(data); byteIndex += superblock.getBlockSize(); * * //read the inode table //XXX what if it doesn't fit? Inode inodeTable[] = new Inode[ (int)superblock.getInodesCount() ]; */ } catch (FileSystemException e) { throw e; } catch (Exception e) { throw new FileSystemException(e); } log.debug("Ext2fs filesystem constructed sucessfully"); log.debug( " superblock: #blocks: " + superblock.getBlocksCount() + "\n" + " #blocks/group: " + superblock.getBlocksPerGroup() + "\n" + " #block groups: " + groupCount + "\n" + " block size: " + superblock.getBlockSize() + "\n" + " #inodes: " + superblock.getINodesCount() + "\n" + " #inodes/group: " + superblock.getINodesPerGroup()); }
public Ext2FileSystem(Device device) throws FileSystemException { if (device == null) { throw new FileSystemException("null device!"); } this.device = device; try { this.api = (FSBlockDeviceAPI) device.getAPI(FSBlockDeviceAPI.class); } catch (ApiNotFoundException ex) { throw new FileSystemException("Device is not a partition", ex); } closed = false; byte data[]; //points to the byte where the fs metadata parsing has reached long byteIndex; cache = new BlockCache(50, (float) 0.75); try { data = new byte[Superblock.SUPERBLOCK_LENGTH]; //skip the first 1024 bytes (bootsector) and read the superblock byteIndex = 1024; api.read(byteIndex, data, 0, Superblock.SUPERBLOCK_LENGTH); byteIndex += Superblock.SUPERBLOCK_LENGTH; superblock = new Superblock(data); //read the group descriptors groupCount = (int) Math.ceil((double) superblock.getBlocksCount() / (double) superblock.getBlocksPerGroup()); groupDescriptors = new GroupDescriptor[groupCount]; for (int i = 0; i < groupCount; i++) { data = new byte[GroupDescriptor.GROUPDESCRIPTOR_LENGTH]; api.read(byteIndex + i * GroupDescriptor.GROUPDESCRIPTOR_LENGTH, data, 0, GroupDescriptor.GROUPDESCRIPTOR_LENGTH); groupDescriptors[i] = new GroupDescriptor(data); } byteIndex += superblock.getBlockSize(); /* * //go through each block group //XXX byteIndex = ... //read the block bitmap //XXX what if it doesn't fit? data = new byte[(int)superblock.getBlockSize()]; api.read( byteIndex, data, 0, * (int)superblock.getBlockSize()); FSBitmap blockBitmap = new FSBitmap(data); byteIndex += superblock.getBlockSize(); * * //read the inode bitmap //XXX what if it doesn't fit? data = new byte[(int)superblock.getBlockSize()]; api.read( byteIndex, data, 0, (int)superblock.getBlockSize()); FSBitmap * inodeBitmap = new FSBitmap(data); byteIndex += superblock.getBlockSize(); * * //read the inode table //XXX what if it doesn't fit? Inode inodeTable[] = new Inode[ (int)superblock.getInodesCount() ]; */ } catch (FileSystemException e) { throw e; } catch (Exception e) { throw new FileSystemException(e); } log.debug("Ext2fs filesystem constructed sucessfully"); log.debug( " superblock: #blocks: " + superblock.getBlocksCount() + "\n" + " #blocks/group: " + superblock.getBlocksPerGroup() + "\n" + " #block groups: " + groupCount + "\n" + " block size: " + superblock.getBlockSize() + "\n" + " #inodes: " + superblock.getINodesCount() + "\n" + " #inodes/group: " + superblock.getINodesPerGroup()); }
11,021
public Ext2FileSystem(Device device) throws FileSystemException { if (device == null) { throw new FileSystemException("null device!"); } this.device = device; try { this.api = (FSBlockDeviceAPI) device.getAPI(FSBlockDeviceAPI.class); } catch (ApiNotFoundException ex) { throw new FileSystemException("Device is not a partition", ex); } closed = false; byte data[]; //points to the byte where the fs metadata parsing has reached long byteIndex; cache = new BlockCache(50, (float) 0.75); try { data = new byte[Superblock.SUPERBLOCK_LENGTH]; //skip the first 1024 bytes (bootsector) and read the superblock byteIndex = 1024; api.read(byteIndex, data, 0, Superblock.SUPERBLOCK_LENGTH); byteIndex += Superblock.SUPERBLOCK_LENGTH; superblock = new Superblock(data); //read the group descriptors groupCount = (int) Math.ceil((double) superblock.getBlocksCount() / (double) superblock.getBlocksPerGroup()); groupDescriptors = new GroupDescriptor[groupCount]; for (int i = 0; i < groupCount; i++) { data = new byte[GroupDescriptor.GROUPDESCRIPTOR_LENGTH]; api.read(byteIndex + i * GroupDescriptor.GROUPDESCRIPTOR_LENGTH, data, 0, GroupDescriptor.GROUPDESCRIPTOR_LENGTH); groupDescriptors[i] = new GroupDescriptor(data); } byteIndex += superblock.getBlockSize(); /* * //go through each block group //XXX byteIndex = ... //read the block bitmap //XXX what if it doesn't fit? data = new byte[(int)superblock.getBlockSize()]; api.read( byteIndex, data, 0, * (int)superblock.getBlockSize()); FSBitmap blockBitmap = new FSBitmap(data); byteIndex += superblock.getBlockSize(); * * //read the inode bitmap //XXX what if it doesn't fit? data = new byte[(int)superblock.getBlockSize()]; api.read( byteIndex, data, 0, (int)superblock.getBlockSize()); FSBitmap * inodeBitmap = new FSBitmap(data); byteIndex += superblock.getBlockSize(); * * //read the inode table //XXX what if it doesn't fit? Inode inodeTable[] = new Inode[ (int)superblock.getInodesCount() ]; */ } catch (FileSystemException e) { throw e; } catch (Exception e) { throw new FileSystemException(e); } log.debug("Ext2fs filesystem constructed sucessfully"); log.debug( " superblock: #blocks: " + superblock.getBlocksCount() + "\n" + " #blocks/group: " + superblock.getBlocksPerGroup() + "\n" + " #block groups: " + groupCount + "\n" + " block size: " + superblock.getBlockSize() + "\n" + " #inodes: " + superblock.getINodesCount() + "\n" + " #inodes/group: " + superblock.getINodesPerGroup()); }
public Ext2FileSystem(Device device) throws FileSystemException { if (device == null) { throw new FileSystemException("null device!"); } this.device = device; try { this.api = (FSBlockDeviceAPI) device.getAPI(FSBlockDeviceAPI.class); } catch (ApiNotFoundException ex) { throw new FileSystemException("Device is not a partition", ex); } closed = false; byte data[]; //points to the byte where the fs metadata parsing has reached long byteIndex; cache = new BlockCache(50, (float) 0.75); try { data = new byte[Superblock.SUPERBLOCK_LENGTH]; //skip the first 1024 bytes (bootsector) and read the superblock byteIndex = 1024; api.read(byteIndex, data, 0, Superblock.SUPERBLOCK_LENGTH); byteIndex += Superblock.SUPERBLOCK_LENGTH; superblock = new Superblock(data); //read the group descriptors groupCount = (int) Math.ceil((double) superblock.getBlocksCount() / (double) superblock.getBlocksPerGroup()); groupDescriptors = new GroupDescriptor[groupCount]; for (int i = 0; i < groupCount; i++) { data = new byte[GroupDescriptor.GROUPDESCRIPTOR_LENGTH]; api.read(byteIndex + i * GroupDescriptor.GROUPDESCRIPTOR_LENGTH, data, 0, GroupDescriptor.GROUPDESCRIPTOR_LENGTH); groupDescriptors[i] = new GroupDescriptor(data); } */ /* * //go through each block group //XXX byteIndex = ... //read the block bitmap //XXX what if it doesn't fit? data = new byte[(int)superblock.getBlockSize()]; api.read( byteIndex, data, 0, * (int)superblock.getBlockSize()); FSBitmap blockBitmap = new FSBitmap(data); */ * * //read the inode bitmap //XXX what if it doesn't fit? data = new byte[(int)superblock.getBlockSize()]; api.read( byteIndex, data, 0, (int)superblock.getBlockSize()); FSBitmap * inodeBitmap = new FSBitmap(data); */ * * //read the inode table //XXX what if it doesn't fit? Inode inodeTable[] = new Inode[ (int)superblock.getInodesCount() ]; */ } catch (FileSystemException e) { throw e; } catch (Exception e) { throw new FileSystemException(e); } log.debug("Ext2fs filesystem constructed sucessfully"); log.debug( " superblock: #blocks: " + superblock.getBlocksCount() + "\n" + " #blocks/group: " + superblock.getBlocksPerGroup() + "\n" + " #block groups: " + groupCount + "\n" + " block size: " + superblock.getBlockSize() + "\n" + " #inodes: " + superblock.getINodesCount() + "\n" + " #inodes/group: " + superblock.getINodesPerGroup()); }
11,022
public Ext2FileSystem(Device device) throws FileSystemException { if (device == null) { throw new FileSystemException("null device!"); } this.device = device; try { this.api = (FSBlockDeviceAPI) device.getAPI(FSBlockDeviceAPI.class); } catch (ApiNotFoundException ex) { throw new FileSystemException("Device is not a partition", ex); } closed = false; byte data[]; //points to the byte where the fs metadata parsing has reached long byteIndex; cache = new BlockCache(50, (float) 0.75); try { data = new byte[Superblock.SUPERBLOCK_LENGTH]; //skip the first 1024 bytes (bootsector) and read the superblock byteIndex = 1024; api.read(byteIndex, data, 0, Superblock.SUPERBLOCK_LENGTH); byteIndex += Superblock.SUPERBLOCK_LENGTH; superblock = new Superblock(data); //read the group descriptors groupCount = (int) Math.ceil((double) superblock.getBlocksCount() / (double) superblock.getBlocksPerGroup()); groupDescriptors = new GroupDescriptor[groupCount]; for (int i = 0; i < groupCount; i++) { data = new byte[GroupDescriptor.GROUPDESCRIPTOR_LENGTH]; api.read(byteIndex + i * GroupDescriptor.GROUPDESCRIPTOR_LENGTH, data, 0, GroupDescriptor.GROUPDESCRIPTOR_LENGTH); groupDescriptors[i] = new GroupDescriptor(data); } byteIndex += superblock.getBlockSize(); /* * //go through each block group //XXX byteIndex = ... //read the block bitmap //XXX what if it doesn't fit? data = new byte[(int)superblock.getBlockSize()]; api.read( byteIndex, data, 0, * (int)superblock.getBlockSize()); FSBitmap blockBitmap = new FSBitmap(data); byteIndex += superblock.getBlockSize(); * * //read the inode bitmap //XXX what if it doesn't fit? data = new byte[(int)superblock.getBlockSize()]; api.read( byteIndex, data, 0, (int)superblock.getBlockSize()); FSBitmap * inodeBitmap = new FSBitmap(data); byteIndex += superblock.getBlockSize(); * * //read the inode table //XXX what if it doesn't fit? Inode inodeTable[] = new Inode[ (int)superblock.getInodesCount() ]; */ } catch (FileSystemException e) { throw e; } catch (Exception e) { throw new FileSystemException(e); } log.debug("Ext2fs filesystem constructed sucessfully"); log.debug( " superblock: #blocks: " + superblock.getBlocksCount() + "\n" + " #blocks/group: " + superblock.getBlocksPerGroup() + "\n" + " #block groups: " + groupCount + "\n" + " block size: " + superblock.getBlockSize() + "\n" + " #inodes: " + superblock.getINodesCount() + "\n" + " #inodes/group: " + superblock.getINodesPerGroup()); }
public Ext2FileSystem(Device device) throws FileSystemException { if (device == null) { throw new FileSystemException("null device!"); } this.device = device; try { this.api = (FSBlockDeviceAPI) device.getAPI(FSBlockDeviceAPI.class); } catch (ApiNotFoundException ex) { throw new FileSystemException("Device is not a partition", ex); } closed = false; byte data[]; //points to the byte where the fs metadata parsing has reached long byteIndex; cache = new BlockCache(50, (float) 0.75); try { data = new byte[Superblock.SUPERBLOCK_LENGTH]; //skip the first 1024 bytes (bootsector) and read the superblock byteIndex = 1024; api.read(byteIndex, data, 0, Superblock.SUPERBLOCK_LENGTH); byteIndex += Superblock.SUPERBLOCK_LENGTH; superblock = new Superblock(data); //read the group descriptors groupCount = (int) Math.ceil((double) superblock.getBlocksCount() / (double) superblock.getBlocksPerGroup()); groupDescriptors = new GroupDescriptor[groupCount]; for (int i = 0; i < groupCount; i++) { data = new byte[GroupDescriptor.GROUPDESCRIPTOR_LENGTH]; api.read(byteIndex + i * GroupDescriptor.GROUPDESCRIPTOR_LENGTH, data, 0, GroupDescriptor.GROUPDESCRIPTOR_LENGTH); groupDescriptors[i] = new GroupDescriptor(data); } byteIndex += superblock.getBlockSize(); /* * //go through each block group //XXX byteIndex = ... //read the block bitmap //XXX what if it doesn't fit? data = new byte[(int)superblock.getBlockSize()]; api.read( byteIndex, data, 0, * (int)superblock.getBlockSize()); FSBitmap blockBitmap = new FSBitmap(data); byteIndex += superblock.getBlockSize(); * * //read the inode bitmap //XXX what if it doesn't fit? data = new byte[(int)superblock.getBlockSize()]; api.read( byteIndex, data, 0, (int)superblock.getBlockSize()); FSBitmap * inodeBitmap = new FSBitmap(data); byteIndex += superblock.getBlockSize(); * * //read the inode table //XXX what if it doesn't fit? Inode inodeTable[] = new Inode[ (int)superblock.getInodesCount() ]; */ } catch (FileSystemException e) { throw e; } catch (Exception e) { throw new FileSystemException(e); } log.debug("Ext2fs filesystem constructed sucessfully"); log.debug( " superblock: #blocks: " + superblock.getBlocksCount() + "\n" + " #blocks/group: " + superblock.getBlocksPerGroup() + "\n" + " #block groups: " + groupCount + "\n" + " block size: " + superblock.getBlockSize() + "\n" + " #inodes: " + superblock.getINodesCount() + "\n" + " #inodes/group: " + superblock.getINodesPerGroup()); }
11,023
public void close() throws IOException { flush(); closed = true; //XXX throw new IOException("Yet unimplemented"); }
public void close() throws IOException { flush(); closed = true; //XXX throw new IOException("Yet unimplemented"); }
11,024
public void flush() throws IOException { //XXX throw new IOException("Yet unimplemented"); }
public void flush() throws IOException { //XXX log.info("Filesystem flushed"); }
11,025
public byte[] getBlock(long nr) throws IOException { int blockSize = superblock.getBlockSize(); Block result; Integer key = new Integer((int) nr); //check if the block has already been retrieved if (cache.containsKey(key)) result = (Block) cache.get(key); else { byte[] data = new byte[blockSize]; api.read(nr * blockSize, data, 0, blockSize); result = new Block(data); cache.put(key, result); } return result.getData(); }
public byte[] getBlock(long nr) throws IOException { int blockSize = superblock.getBlockSize(); Block result; Integer key = new Integer((int) nr); //check if the block has already been retrieved if (cache.containsKey(key)) result = (Block) cache.get(key); else { byte[] data = new byte[blockSize]; api.read(nr * blockSize, data, 0, blockSize); result = new Block(data); cache.put(key, result); } return result.getData(); }
11,026
public INode getINode(int iNodeNr) throws IOException, FileSystemException { if (iNodeNr < 1) throw new IOException("INode number must be greater than 0"); int group = (int) ((iNodeNr - 1) / superblock.getINodesPerGroup()); int index = (int) ((iNodeNr - 1) % superblock.getINodesPerGroup()); //get the part of the inode table that contains the inode long iNodeTableBlock = groupDescriptors[group].getInodeTable(); //the first block of the inode table INodeTable iNodeTable = new INodeTable(this, (int) iNodeTableBlock); return new INode(this, iNodeTable.getInodeData(index)); }
public INode getINode(int iNodeNr) throws IOException, FileSystemException { if (iNodeNr < 1) throw new IOException("INode number must be greater than 0"); int group = (int) ((iNodeNr - 1) / superblock.getINodesPerGroup()); int index = (int) ((iNodeNr - 1) % superblock.getINodesPerGroup()); //get the part of the inode table that contains the inode long iNodeTableBlock = groupDescriptors[group].getInodeTable(); //the first block of the inode table INodeTable iNodeTable = new INodeTable(this, (int) iNodeTableBlock); return new INode(this, iNodeTable.getInodeData(index)); }
11,027
public FSEntry getRootEntry() throws IOException { log.debug("Ext2FileSystem.getRootEntry()"); try { if (!closed) { return new Ext2Entry(getINode(Ext2Constants.EXT2_ROOT_INO), "/", Ext2Constants.EXT2_FT_DIR); } } catch (FileSystemException e) { throw new IOException(e); } return null; }
public FSEntry getRootEntry() throws IOException { log.debug("Ext2FileSystem.getRootEntry()"); try { if (!closed) { return new Ext2Entry(getINode(Ext2Constants.EXT2_ROOT_INO), "/", Ext2Constants.EXT2_FT_DIR); } } catch (FileSystemException e) { throw new IOException(e); } return null; }
11,028
public Superblock() { data = new byte[SUPERBLOCK_LENGTH]; log.setLevel(Level.DEBUG); }
public Superblock() { data = new byte[SUPERBLOCK_LENGTH]; log.setLevel(Level.INFO); }
11,030
public GroupDescriptor() { data = new byte[GROUPDESCRIPTOR_LENGTH]; log.setLevel(Level.DEBUG); }
public GroupDescriptor() { data = new byte[GROUPDESCRIPTOR_LENGTH]; log.setLevel(Level.INFO); }
11,031
public INode(Ext2FileSystem fs, INodeDescriptor desc) { this.fs = fs; this.desc = desc; this.data = new byte[INODE_LENGTH]; log.setLevel(Level.DEBUG); }
public INode(Ext2FileSystem fs, INodeDescriptor desc) { this.fs = fs; this.desc = desc; this.data = new byte[INODE_LENGTH]; log.setLevel(Level.INFO); }
11,032
protected void update() throws IOException{ try{ if(dirty) { log.debug(" ** updating inode **"); desc.getINodeTable().writeInodeData( desc.getIndex(), data ); dirty=false; } }catch(FileSystemException fs) { throw new IOException(fs); } }
protected synchronized void update() throws IOException{ try{ if(dirty) { log.debug(" ** updating inode **"); desc.getINodeTable().writeInodeData( desc.getIndex(), data ); dirty=false; } }catch(FileSystemException fs) { throw new IOException(fs); } }
11,033
public void flush() { if (!dirty) return; //XXX... log.error("BLOCK FLUSHED FROM CACHE"); }
public void flush() { if (!dirty) return; //XXX... log.error("BLOCK FLUSHED FROM CACHE"); }
11,034
public void flush() { if (!dirty) return; //XXX... log.error("BLOCK FLUSHED FROM CACHE"); }
public void flush() { if (!dirty) return; //XXX... fs.writeBlock(blockNr, data, true); log.debug("BLOCK FLUSHED FROM CACHE"); }
11,035
public boolean containsKey(Integer key) { boolean result = super.containsKey(key); if(result) log.debug("CACHE HIT, size:"+size()); else log.debug("CACHE MISS"); return result; }
private boolean containsKey(Integer key) { boolean result = super.containsKey(key); if(result) log.debug("CACHE HIT, size:"+size()); else log.debug("CACHE MISS"); return result; }
11,036
public Block(byte[] data) { this.data = data; }
public Block(byte[] data) { this.data = data; }
11,037
public Ext2Entry(INode iNode, String name, int type) { this.iNode = iNode; this.name = name; this.type = type; this.valid = true; log.debug("Ext2Entry(iNode, name): name="+name+ (isDirectory()?" is a directory ":"")+ (isFile()?" is a file ":"")); }
public Ext2Entry(INode iNode, String name, int type, Ext2FileSystem fs) { this.iNode = iNode; this.name = name; this.type = type; this.valid = true; log.debug("Ext2Entry(iNode, name): name="+name+ (isDirectory()?" is a directory ":"")+ (isFile()?" is a file ":"")); }
11,038
public RenderContext(AffineTransform xform) { this(xform, null, null); }
public RenderContext(AffineTransform xform, Shape aoi, RenderingHints hints) { this(xform, null, null); }
11,040
public RenderContext(AffineTransform xform) { this(xform, null, null); }
public RenderContext(AffineTransform xform) { this.xform = xform; this.aoi = aoi; this.hints = hints; }
11,041
public String replaceAll(String replacement) { throw new InternalError("Not implemented yet"); }
public String replaceAll(String replacement) { reset(); return pattern.getRE().substituteAll(input, replacement, position); }
11,042
public String replaceFirst(String replacement) { throw new InternalError("Not implemented yet"); }
public String replaceFirst(String replacement) { reset(); return pattern.getRE().substitute(input, replacement, position); }
11,043
public void addItem(MenuItem item) { Action action = new AbstractAction(){ public void actionPerformed(ActionEvent e) { //todo implement it } }; action.putValue(Action.NAME, item.getLabel()); ((JPopupMenu)jComponent).add(action); }
public void addItem(MenuItem item) { Action action = new AbstractAction(){ public void actionPerformed(ActionEvent e) { //todo implement it } }; action.putValue(Action.NAME, item.getLabel()); ((JPopupMenu)jComponent).add(action); }
11,044
public void setArc(Rectangle2D r, double start, double extent, int type) { setArc(r.getX(), r.getY(), r.getWidth(), r.getHeight(), start, extent, type); }
public void setArc(Rectangle2D r, double start, double extent, int type) { setArc(r.getX(), r.getY(), r.getWidth(), r.getHeight(), start, extent, type); }
11,045
final RadeonSurface open(RadeonConfiguration config) throws ResourceNotFreeException { // Get the best matching config config = fbinfo.getBestConfiguration(config); log.info("BestConfig:" + config); // Calculate new configuration final DisplayMode mode = config.getDisplayMode(); final int width = mode.getWidth(); final int height = mode.getHeight(); final int pixels = width * height; final int bitsPerPixel = config.getBitsPerPixel(); final int bytesPerLine = config.getBytesPerLine(); final int bytesPerScreen = bytesPerLine * height; log.info("PLLInfo:" + fbinfo.getPllInfo()); currentState.calcForConfiguration(config, vgaIO, fbinfo); // Disable video interrupts vgaIO.disableIRQ(); // Allocate the screen memory final MemoryResource screen = claimDeviceMemory(bytesPerScreen, 4 * 1024); //final MemoryResource screen = deviceRam; log.info("Screen at 0x" + NumberUtils.hex(screen.getOffset()) + ", size 0x" + NumberUtils.hex(screen.getSize())); //if (true) { throw new ResourceNotFreeException("TEST"); } // Save the current state oldVgaState.saveFromVGA(vgaIO); log.info("oldState:" + oldVgaState); // Turn off the screen final DpmsState dpmsState = getDpms(); setDpms(DpmsState.OFF); try { // Set the new configuration currentState.restoreToVGA(vgaIO); log.info("NewState: " + currentState); vgaIO.setReg32(CRTC_OFFSET, (int) screen.getOffset()); if (fbinfo.hasCRTC2) { vgaIO.setReg32(CRTC2_OFFSET, (int) screen.getOffset()); } // Set the 8-bit palette setPalette(1.0f); // Create the graphics helper & clear the screen final BitmapGraphics bitmapGraphics; switch (bitsPerPixel) { case 8: bitmapGraphics = BitmapGraphics.create8bppInstance(screen, width, height, bytesPerLine, 0); screen.setByte(0, (byte) 0, pixels); break; case 16: bitmapGraphics = BitmapGraphics.create16bppInstance(screen, width, height, bytesPerLine, 0); screen.setShort(0, (byte) 0, pixels); break; case 24: bitmapGraphics = BitmapGraphics.create24bppInstance(screen, width, height, bytesPerLine, 0); screen.setInt24(0, 0, pixels); break; case 32: bitmapGraphics = BitmapGraphics.create32bppInstance(screen, width, height, bytesPerLine, 0); screen.setInt(0, 0, pixels); break; default: throw new IllegalArgumentException("Invalid bits per pixel " + bitsPerPixel); } return new RadeonSurface(this, config, bitmapGraphics, screen); } finally { // Turn the screen back on setDpms(dpmsState); } }
final RadeonSurface open(RadeonConfiguration config) throws ResourceNotFreeException { // Get the best matching config config = fbinfo.getBestConfiguration(config); log.info("BestConfig:" + config); // Calculate new configuration final DisplayMode mode = config.getDisplayMode(); final int width = mode.getWidth(); final int height = mode.getHeight(); final int pixels = width * height; final int bitsPerPixel = config.getBitsPerPixel(); final int bytesPerLine = config.getBytesPerLine(); final int bytesPerScreen = bytesPerLine * height; log.debug("PLLInfo:" + fbinfo.getPllInfo()); currentState.calcForConfiguration(config, vgaIO, fbinfo); // Disable video interrupts vgaIO.disableIRQ(); // Allocate the screen memory final MemoryResource screen = claimDeviceMemory(bytesPerScreen, 4 * 1024); //final MemoryResource screen = deviceRam; log.info("Screen at 0x" + NumberUtils.hex(screen.getOffset()) + ", size 0x" + NumberUtils.hex(screen.getSize())); //if (true) { throw new ResourceNotFreeException("TEST"); } // Save the current state oldVgaState.saveFromVGA(vgaIO); log.info("oldState:" + oldVgaState); // Turn off the screen final DpmsState dpmsState = getDpms(); setDpms(DpmsState.OFF); try { // Set the new configuration currentState.restoreToVGA(vgaIO); log.info("NewState: " + currentState); vgaIO.setReg32(CRTC_OFFSET, (int) screen.getOffset()); if (fbinfo.hasCRTC2) { vgaIO.setReg32(CRTC2_OFFSET, (int) screen.getOffset()); } // Set the 8-bit palette setPalette(1.0f); // Create the graphics helper & clear the screen final BitmapGraphics bitmapGraphics; switch (bitsPerPixel) { case 8: bitmapGraphics = BitmapGraphics.create8bppInstance(screen, width, height, bytesPerLine, 0); screen.setByte(0, (byte) 0, pixels); break; case 16: bitmapGraphics = BitmapGraphics.create16bppInstance(screen, width, height, bytesPerLine, 0); screen.setShort(0, (byte) 0, pixels); break; case 24: bitmapGraphics = BitmapGraphics.create24bppInstance(screen, width, height, bytesPerLine, 0); screen.setInt24(0, 0, pixels); break; case 32: bitmapGraphics = BitmapGraphics.create32bppInstance(screen, width, height, bytesPerLine, 0); screen.setInt(0, 0, pixels); break; default: throw new IllegalArgumentException("Invalid bits per pixel " + bitsPerPixel); } return new RadeonSurface(this, config, bitmapGraphics, screen); } finally { // Turn the screen back on setDpms(dpmsState); } }
11,046
final RadeonSurface open(RadeonConfiguration config) throws ResourceNotFreeException { // Get the best matching config config = fbinfo.getBestConfiguration(config); log.info("BestConfig:" + config); // Calculate new configuration final DisplayMode mode = config.getDisplayMode(); final int width = mode.getWidth(); final int height = mode.getHeight(); final int pixels = width * height; final int bitsPerPixel = config.getBitsPerPixel(); final int bytesPerLine = config.getBytesPerLine(); final int bytesPerScreen = bytesPerLine * height; log.info("PLLInfo:" + fbinfo.getPllInfo()); currentState.calcForConfiguration(config, vgaIO, fbinfo); // Disable video interrupts vgaIO.disableIRQ(); // Allocate the screen memory final MemoryResource screen = claimDeviceMemory(bytesPerScreen, 4 * 1024); //final MemoryResource screen = deviceRam; log.info("Screen at 0x" + NumberUtils.hex(screen.getOffset()) + ", size 0x" + NumberUtils.hex(screen.getSize())); //if (true) { throw new ResourceNotFreeException("TEST"); } // Save the current state oldVgaState.saveFromVGA(vgaIO); log.info("oldState:" + oldVgaState); // Turn off the screen final DpmsState dpmsState = getDpms(); setDpms(DpmsState.OFF); try { // Set the new configuration currentState.restoreToVGA(vgaIO); log.info("NewState: " + currentState); vgaIO.setReg32(CRTC_OFFSET, (int) screen.getOffset()); if (fbinfo.hasCRTC2) { vgaIO.setReg32(CRTC2_OFFSET, (int) screen.getOffset()); } // Set the 8-bit palette setPalette(1.0f); // Create the graphics helper & clear the screen final BitmapGraphics bitmapGraphics; switch (bitsPerPixel) { case 8: bitmapGraphics = BitmapGraphics.create8bppInstance(screen, width, height, bytesPerLine, 0); screen.setByte(0, (byte) 0, pixels); break; case 16: bitmapGraphics = BitmapGraphics.create16bppInstance(screen, width, height, bytesPerLine, 0); screen.setShort(0, (byte) 0, pixels); break; case 24: bitmapGraphics = BitmapGraphics.create24bppInstance(screen, width, height, bytesPerLine, 0); screen.setInt24(0, 0, pixels); break; case 32: bitmapGraphics = BitmapGraphics.create32bppInstance(screen, width, height, bytesPerLine, 0); screen.setInt(0, 0, pixels); break; default: throw new IllegalArgumentException("Invalid bits per pixel " + bitsPerPixel); } return new RadeonSurface(this, config, bitmapGraphics, screen); } finally { // Turn the screen back on setDpms(dpmsState); } }
final RadeonSurface open(RadeonConfiguration config) throws ResourceNotFreeException { // Get the best matching config config = fbinfo.getBestConfiguration(config); log.info("BestConfig:" + config); // Calculate new configuration final DisplayMode mode = config.getDisplayMode(); final int width = mode.getWidth(); final int height = mode.getHeight(); final int pixels = width * height; final int bitsPerPixel = config.getBitsPerPixel(); final int bytesPerLine = config.getBytesPerLine(); final int bytesPerScreen = bytesPerLine * height; log.info("PLLInfo:" + fbinfo.getPllInfo()); currentState.calcForConfiguration(config, vgaIO, fbinfo); // Disable video interrupts vgaIO.disableIRQ(); // Allocate the screen memory final MemoryResource screen = claimDeviceMemory(bytesPerScreen, 4 * 1024); //final MemoryResource screen = deviceRam; log.debug("Screen at 0x" + NumberUtils.hex(screen.getOffset()) + ", size 0x" + NumberUtils.hex(screen.getSize())); //if (true) { throw new ResourceNotFreeException("TEST"); } // Save the current state oldVgaState.saveFromVGA(vgaIO); log.info("oldState:" + oldVgaState); // Turn off the screen final DpmsState dpmsState = getDpms(); setDpms(DpmsState.OFF); try { // Set the new configuration currentState.restoreToVGA(vgaIO); log.info("NewState: " + currentState); vgaIO.setReg32(CRTC_OFFSET, (int) screen.getOffset()); if (fbinfo.hasCRTC2) { vgaIO.setReg32(CRTC2_OFFSET, (int) screen.getOffset()); } // Set the 8-bit palette setPalette(1.0f); // Create the graphics helper & clear the screen final BitmapGraphics bitmapGraphics; switch (bitsPerPixel) { case 8: bitmapGraphics = BitmapGraphics.create8bppInstance(screen, width, height, bytesPerLine, 0); screen.setByte(0, (byte) 0, pixels); break; case 16: bitmapGraphics = BitmapGraphics.create16bppInstance(screen, width, height, bytesPerLine, 0); screen.setShort(0, (byte) 0, pixels); break; case 24: bitmapGraphics = BitmapGraphics.create24bppInstance(screen, width, height, bytesPerLine, 0); screen.setInt24(0, 0, pixels); break; case 32: bitmapGraphics = BitmapGraphics.create32bppInstance(screen, width, height, bytesPerLine, 0); screen.setInt(0, 0, pixels); break; default: throw new IllegalArgumentException("Invalid bits per pixel " + bitsPerPixel); } return new RadeonSurface(this, config, bitmapGraphics, screen); } finally { // Turn the screen back on setDpms(dpmsState); } }
11,047
final RadeonSurface open(RadeonConfiguration config) throws ResourceNotFreeException { // Get the best matching config config = fbinfo.getBestConfiguration(config); log.info("BestConfig:" + config); // Calculate new configuration final DisplayMode mode = config.getDisplayMode(); final int width = mode.getWidth(); final int height = mode.getHeight(); final int pixels = width * height; final int bitsPerPixel = config.getBitsPerPixel(); final int bytesPerLine = config.getBytesPerLine(); final int bytesPerScreen = bytesPerLine * height; log.info("PLLInfo:" + fbinfo.getPllInfo()); currentState.calcForConfiguration(config, vgaIO, fbinfo); // Disable video interrupts vgaIO.disableIRQ(); // Allocate the screen memory final MemoryResource screen = claimDeviceMemory(bytesPerScreen, 4 * 1024); //final MemoryResource screen = deviceRam; log.info("Screen at 0x" + NumberUtils.hex(screen.getOffset()) + ", size 0x" + NumberUtils.hex(screen.getSize())); //if (true) { throw new ResourceNotFreeException("TEST"); } // Save the current state oldVgaState.saveFromVGA(vgaIO); log.info("oldState:" + oldVgaState); // Turn off the screen final DpmsState dpmsState = getDpms(); setDpms(DpmsState.OFF); try { // Set the new configuration currentState.restoreToVGA(vgaIO); log.info("NewState: " + currentState); vgaIO.setReg32(CRTC_OFFSET, (int) screen.getOffset()); if (fbinfo.hasCRTC2) { vgaIO.setReg32(CRTC2_OFFSET, (int) screen.getOffset()); } // Set the 8-bit palette setPalette(1.0f); // Create the graphics helper & clear the screen final BitmapGraphics bitmapGraphics; switch (bitsPerPixel) { case 8: bitmapGraphics = BitmapGraphics.create8bppInstance(screen, width, height, bytesPerLine, 0); screen.setByte(0, (byte) 0, pixels); break; case 16: bitmapGraphics = BitmapGraphics.create16bppInstance(screen, width, height, bytesPerLine, 0); screen.setShort(0, (byte) 0, pixels); break; case 24: bitmapGraphics = BitmapGraphics.create24bppInstance(screen, width, height, bytesPerLine, 0); screen.setInt24(0, 0, pixels); break; case 32: bitmapGraphics = BitmapGraphics.create32bppInstance(screen, width, height, bytesPerLine, 0); screen.setInt(0, 0, pixels); break; default: throw new IllegalArgumentException("Invalid bits per pixel " + bitsPerPixel); } return new RadeonSurface(this, config, bitmapGraphics, screen); } finally { // Turn the screen back on setDpms(dpmsState); } }
final RadeonSurface open(RadeonConfiguration config) throws ResourceNotFreeException { // Get the best matching config config = fbinfo.getBestConfiguration(config); log.info("BestConfig:" + config); // Calculate new configuration final DisplayMode mode = config.getDisplayMode(); final int width = mode.getWidth(); final int height = mode.getHeight(); final int pixels = width * height; final int bitsPerPixel = config.getBitsPerPixel(); final int bytesPerLine = config.getBytesPerLine(); final int bytesPerScreen = bytesPerLine * height; log.info("PLLInfo:" + fbinfo.getPllInfo()); currentState.calcForConfiguration(config, vgaIO, fbinfo); // Disable video interrupts vgaIO.disableIRQ(); // Allocate the screen memory final MemoryResource screen = claimDeviceMemory(bytesPerScreen, 4 * 1024); //final MemoryResource screen = deviceRam; log.info("Screen at 0x" + NumberUtils.hex(screen.getOffset()) + ", size 0x" + NumberUtils.hex(screen.getSize())); //if (true) { throw new ResourceNotFreeException("TEST"); } // Save the current state oldVgaState.saveFromVGA(vgaIO); log.debug("oldState:" + oldVgaState); // Turn off the screen final DpmsState dpmsState = getDpms(); setDpms(DpmsState.OFF); try { // Set the new configuration currentState.restoreToVGA(vgaIO); log.info("NewState: " + currentState); vgaIO.setReg32(CRTC_OFFSET, (int) screen.getOffset()); if (fbinfo.hasCRTC2) { vgaIO.setReg32(CRTC2_OFFSET, (int) screen.getOffset()); } // Set the 8-bit palette setPalette(1.0f); // Create the graphics helper & clear the screen final BitmapGraphics bitmapGraphics; switch (bitsPerPixel) { case 8: bitmapGraphics = BitmapGraphics.create8bppInstance(screen, width, height, bytesPerLine, 0); screen.setByte(0, (byte) 0, pixels); break; case 16: bitmapGraphics = BitmapGraphics.create16bppInstance(screen, width, height, bytesPerLine, 0); screen.setShort(0, (byte) 0, pixels); break; case 24: bitmapGraphics = BitmapGraphics.create24bppInstance(screen, width, height, bytesPerLine, 0); screen.setInt24(0, 0, pixels); break; case 32: bitmapGraphics = BitmapGraphics.create32bppInstance(screen, width, height, bytesPerLine, 0); screen.setInt(0, 0, pixels); break; default: throw new IllegalArgumentException("Invalid bits per pixel " + bitsPerPixel); } return new RadeonSurface(this, config, bitmapGraphics, screen); } finally { // Turn the screen back on setDpms(dpmsState); } }
11,048
final RadeonSurface open(RadeonConfiguration config) throws ResourceNotFreeException { // Get the best matching config config = fbinfo.getBestConfiguration(config); log.info("BestConfig:" + config); // Calculate new configuration final DisplayMode mode = config.getDisplayMode(); final int width = mode.getWidth(); final int height = mode.getHeight(); final int pixels = width * height; final int bitsPerPixel = config.getBitsPerPixel(); final int bytesPerLine = config.getBytesPerLine(); final int bytesPerScreen = bytesPerLine * height; log.info("PLLInfo:" + fbinfo.getPllInfo()); currentState.calcForConfiguration(config, vgaIO, fbinfo); // Disable video interrupts vgaIO.disableIRQ(); // Allocate the screen memory final MemoryResource screen = claimDeviceMemory(bytesPerScreen, 4 * 1024); //final MemoryResource screen = deviceRam; log.info("Screen at 0x" + NumberUtils.hex(screen.getOffset()) + ", size 0x" + NumberUtils.hex(screen.getSize())); //if (true) { throw new ResourceNotFreeException("TEST"); } // Save the current state oldVgaState.saveFromVGA(vgaIO); log.info("oldState:" + oldVgaState); // Turn off the screen final DpmsState dpmsState = getDpms(); setDpms(DpmsState.OFF); try { // Set the new configuration currentState.restoreToVGA(vgaIO); log.info("NewState: " + currentState); vgaIO.setReg32(CRTC_OFFSET, (int) screen.getOffset()); if (fbinfo.hasCRTC2) { vgaIO.setReg32(CRTC2_OFFSET, (int) screen.getOffset()); } // Set the 8-bit palette setPalette(1.0f); // Create the graphics helper & clear the screen final BitmapGraphics bitmapGraphics; switch (bitsPerPixel) { case 8: bitmapGraphics = BitmapGraphics.create8bppInstance(screen, width, height, bytesPerLine, 0); screen.setByte(0, (byte) 0, pixels); break; case 16: bitmapGraphics = BitmapGraphics.create16bppInstance(screen, width, height, bytesPerLine, 0); screen.setShort(0, (byte) 0, pixels); break; case 24: bitmapGraphics = BitmapGraphics.create24bppInstance(screen, width, height, bytesPerLine, 0); screen.setInt24(0, 0, pixels); break; case 32: bitmapGraphics = BitmapGraphics.create32bppInstance(screen, width, height, bytesPerLine, 0); screen.setInt(0, 0, pixels); break; default: throw new IllegalArgumentException("Invalid bits per pixel " + bitsPerPixel); } return new RadeonSurface(this, config, bitmapGraphics, screen); } finally { // Turn the screen back on setDpms(dpmsState); } }
final RadeonSurface open(RadeonConfiguration config) throws ResourceNotFreeException { // Get the best matching config config = fbinfo.getBestConfiguration(config); log.info("BestConfig:" + config); // Calculate new configuration final DisplayMode mode = config.getDisplayMode(); final int width = mode.getWidth(); final int height = mode.getHeight(); final int pixels = width * height; final int bitsPerPixel = config.getBitsPerPixel(); final int bytesPerLine = config.getBytesPerLine(); final int bytesPerScreen = bytesPerLine * height; log.info("PLLInfo:" + fbinfo.getPllInfo()); currentState.calcForConfiguration(config, vgaIO, fbinfo); // Disable video interrupts vgaIO.disableIRQ(); // Allocate the screen memory final MemoryResource screen = claimDeviceMemory(bytesPerScreen, 4 * 1024); //final MemoryResource screen = deviceRam; log.info("Screen at 0x" + NumberUtils.hex(screen.getOffset()) + ", size 0x" + NumberUtils.hex(screen.getSize())); //if (true) { throw new ResourceNotFreeException("TEST"); } // Save the current state oldVgaState.saveFromVGA(vgaIO); log.info("oldState:" + oldVgaState); // Turn off the screen final DpmsState dpmsState = getDpms(); setDpms(DpmsState.OFF); try { // Set the new configuration currentState.restoreToVGA(vgaIO); log.debug("NewState: " + currentState); vgaIO.setReg32(CRTC_OFFSET, (int) screen.getOffset()); if (fbinfo.hasCRTC2) { vgaIO.setReg32(CRTC2_OFFSET, (int) screen.getOffset()); } // Set the 8-bit palette setPalette(1.0f); // Create the graphics helper & clear the screen final BitmapGraphics bitmapGraphics; switch (bitsPerPixel) { case 8: bitmapGraphics = BitmapGraphics.create8bppInstance(screen, width, height, bytesPerLine, 0); screen.setByte(0, (byte) 0, pixels); break; case 16: bitmapGraphics = BitmapGraphics.create16bppInstance(screen, width, height, bytesPerLine, 0); screen.setShort(0, (byte) 0, pixels); break; case 24: bitmapGraphics = BitmapGraphics.create24bppInstance(screen, width, height, bytesPerLine, 0); screen.setInt24(0, 0, pixels); break; case 32: bitmapGraphics = BitmapGraphics.create32bppInstance(screen, width, height, bytesPerLine, 0); screen.setInt(0, 0, pixels); break; default: throw new IllegalArgumentException("Invalid bits per pixel " + bitsPerPixel); } return new RadeonSurface(this, config, bitmapGraphics, screen); } finally { // Turn the screen back on setDpms(dpmsState); } }
11,049
final void setDpms(DpmsState state) { int crtc_ext_cntl = vgaIO.getReg32(CRTC_EXT_CNTL); int lvds_gen_cntl = vgaIO.getReg32(LVDS_GEN_CNTL);// log.info("Get LVDS_GEN_CTRL 0x" + NumberUtils.hex(lvds_gen_cntl)); crtc_ext_cntl &= ~(CRTC_DISPLAY_DIS | CRTC_HSYNC_DIS | CRTC_VSYNC_DIS); lvds_gen_cntl &= ~(LVDS_DISPLAY_DIS | LVDS_ON); if (state.isDisplay()) { lvds_gen_cntl |= (LVDS_BLON | LVDS_ON); } else { crtc_ext_cntl |= CRTC_DISPLAY_DIS; lvds_gen_cntl |= LVDS_DISPLAY_DIS; } if (!state.isHsync()) { crtc_ext_cntl |= CRTC_HSYNC_DIS; } if (!state.isVsync()) { crtc_ext_cntl |= CRTC_VSYNC_DIS; } if (fbinfo.getDviDispType() == MonitorType.LCD) { vgaIO.setReg32(LVDS_GEN_CNTL, lvds_gen_cntl); log.info("Set LVDS_GEN_CTRL to 0x" + NumberUtils.hex(lvds_gen_cntl)); } else { vgaIO.setReg32(CRTC_EXT_CNTL, crtc_ext_cntl); log.info("Set CRTC_EXT_CNTL to 0x" + NumberUtils.hex(crtc_ext_cntl)); } }
final void setDpms(DpmsState state) { int crtc_ext_cntl = vgaIO.getReg32(CRTC_EXT_CNTL); int lvds_gen_cntl = vgaIO.getReg32(LVDS_GEN_CNTL);// log.info("Get LVDS_GEN_CTRL 0x" + NumberUtils.hex(lvds_gen_cntl)); crtc_ext_cntl &= ~(CRTC_DISPLAY_DIS | CRTC_HSYNC_DIS | CRTC_VSYNC_DIS); lvds_gen_cntl &= ~(LVDS_DISPLAY_DIS | LVDS_ON); if (state.isDisplay()) { lvds_gen_cntl |= (LVDS_BLON | LVDS_ON); } else { crtc_ext_cntl |= CRTC_DISPLAY_DIS; lvds_gen_cntl |= LVDS_DISPLAY_DIS; } if (!state.isHsync()) { crtc_ext_cntl |= CRTC_HSYNC_DIS; } if (!state.isVsync()) { crtc_ext_cntl |= CRTC_VSYNC_DIS; } if (fbinfo.getDviDispType() == MonitorType.LCD) { vgaIO.setReg32(LVDS_GEN_CNTL, lvds_gen_cntl); log.debug("Set LVDS_GEN_CTRL to 0x" + NumberUtils.hex(lvds_gen_cntl)); } else { vgaIO.setReg32(CRTC_EXT_CNTL, crtc_ext_cntl); log.info("Set CRTC_EXT_CNTL to 0x" + NumberUtils.hex(crtc_ext_cntl)); } }
11,050
final void setDpms(DpmsState state) { int crtc_ext_cntl = vgaIO.getReg32(CRTC_EXT_CNTL); int lvds_gen_cntl = vgaIO.getReg32(LVDS_GEN_CNTL);// log.info("Get LVDS_GEN_CTRL 0x" + NumberUtils.hex(lvds_gen_cntl)); crtc_ext_cntl &= ~(CRTC_DISPLAY_DIS | CRTC_HSYNC_DIS | CRTC_VSYNC_DIS); lvds_gen_cntl &= ~(LVDS_DISPLAY_DIS | LVDS_ON); if (state.isDisplay()) { lvds_gen_cntl |= (LVDS_BLON | LVDS_ON); } else { crtc_ext_cntl |= CRTC_DISPLAY_DIS; lvds_gen_cntl |= LVDS_DISPLAY_DIS; } if (!state.isHsync()) { crtc_ext_cntl |= CRTC_HSYNC_DIS; } if (!state.isVsync()) { crtc_ext_cntl |= CRTC_VSYNC_DIS; } if (fbinfo.getDviDispType() == MonitorType.LCD) { vgaIO.setReg32(LVDS_GEN_CNTL, lvds_gen_cntl); log.info("Set LVDS_GEN_CTRL to 0x" + NumberUtils.hex(lvds_gen_cntl)); } else { vgaIO.setReg32(CRTC_EXT_CNTL, crtc_ext_cntl); log.info("Set CRTC_EXT_CNTL to 0x" + NumberUtils.hex(crtc_ext_cntl)); } }
final void setDpms(DpmsState state) { int crtc_ext_cntl = vgaIO.getReg32(CRTC_EXT_CNTL); int lvds_gen_cntl = vgaIO.getReg32(LVDS_GEN_CNTL);// log.info("Get LVDS_GEN_CTRL 0x" + NumberUtils.hex(lvds_gen_cntl)); crtc_ext_cntl &= ~(CRTC_DISPLAY_DIS | CRTC_HSYNC_DIS | CRTC_VSYNC_DIS); lvds_gen_cntl &= ~(LVDS_DISPLAY_DIS | LVDS_ON); if (state.isDisplay()) { lvds_gen_cntl |= (LVDS_BLON | LVDS_ON); } else { crtc_ext_cntl |= CRTC_DISPLAY_DIS; lvds_gen_cntl |= LVDS_DISPLAY_DIS; } if (!state.isHsync()) { crtc_ext_cntl |= CRTC_HSYNC_DIS; } if (!state.isVsync()) { crtc_ext_cntl |= CRTC_VSYNC_DIS; } if (fbinfo.getDviDispType() == MonitorType.LCD) { vgaIO.setReg32(LVDS_GEN_CNTL, lvds_gen_cntl); log.info("Set LVDS_GEN_CTRL to 0x" + NumberUtils.hex(lvds_gen_cntl)); } else { vgaIO.setReg32(CRTC_EXT_CNTL, crtc_ext_cntl); log.debug("Set CRTC_EXT_CNTL to 0x" + NumberUtils.hex(crtc_ext_cntl)); } }
11,051
public ObjectAlreadyActive(String why) { super(why); }
public ObjectAlreadyActive() { super(why); }
11,052
public ObjectAlreadyActive(String why) { super(why); }
public ObjectAlreadyActive(String why) { }
11,053
private UnicodeBlock(char start, char end, String name) { super(name); this.start = start; this.end = end; }
private UnicodeBlock(int start, int end, String name, String canonicalName) { super(name); this.start = start; this.end = end; }
11,054
public static UnicodeBlock of(char ch) { // Special case, since SPECIALS contains two ranges. if (ch == '\uFEFF') return SPECIALS; // Simple binary search for the correct block. int low = 0; int hi = sets.length - 1; while (low <= hi) { int mid = (low + hi) >> 1; UnicodeBlock b = sets[mid]; if (ch < b.start) hi = mid - 1; else if (ch > b.end) low = mid + 1; else return b; } return null; }
public static UnicodeBlock of(char ch) { // Special case, since SPECIALS contains two ranges. if (ch == '\uFEFF') return SPECIALS; // Simple binary search for the correct block. int low = 0; int hi = sets.length - 1; while (low <= hi) { int mid = (low + hi) >> 1; UnicodeBlock b = sets[mid]; if (ch < b.start) hi = mid - 1; else if (ch > b.end) low = mid + 1; else return b; } return null; }
11,056
public Object getParameter(String name) throws DOMException { name = name.toLowerCase(); if ("cdata-sections".equals(name)) { return cdataSections ? Boolean.TRUE : Boolean.FALSE; } else if ("comments".equals(name)) { return comments ? Boolean.TRUE : Boolean.FALSE; } else if ("element-content-whitespace".equals(name)) { return elementContentWhitespace ? Boolean.TRUE : Boolean.FALSE; } else if ("entities".equals(name)) { return entities ? Boolean.TRUE : Boolean.FALSE; } else if ("error-handler".equals(name)) { return errorHandler; } else if ("namespace-declarations".equals(name)) { return namespaceDeclarations ? Boolean.TRUE : Boolean.FALSE; } else if ("split-cdata-sections".equals(name)) { return comments ? Boolean.TRUE : Boolean.FALSE; } else if ("canonical-form".equals(name) || "check-character-normalization".equals(name) || "datatype-normalization".equals(name) || "normalize-characters".equals(name) || "validate".equals(name) || "validate-if-schema".equals(name)) { return Boolean.FALSE; } else if ("namespaces".equals(name) || "well-formed".equals(name)) { return Boolean.TRUE; } else if ("infoset".equals(name)) { return (entities == false && cdataSections == false && namespaceDeclarations == true && comments == true) ? Boolean.TRUE : Boolean.FALSE; } throw new DomEx(DomEx.NOT_SUPPORTED_ERR, name, null, 0); }
public Object getParameter(String name) throws DOMException { name = name.toLowerCase(); if ("cdata-sections".equals(name)) { return cdataSections ? Boolean.TRUE : Boolean.FALSE; } else if ("comments".equals(name)) { return comments ? Boolean.TRUE : Boolean.FALSE; } else if ("element-content-whitespace".equals(name)) { return elementContentWhitespace ? Boolean.TRUE : Boolean.FALSE; } else if ("entities".equals(name)) { return entities ? Boolean.TRUE : Boolean.FALSE; } else if ("error-handler".equals(name)) { return errorHandler; } else if ("namespace-declarations".equals(name)) { return namespaceDeclarations ? Boolean.TRUE : Boolean.FALSE; } else if ("split-cdata-sections".equals(name)) { return comments ? Boolean.TRUE : Boolean.FALSE; } else if ("canonical-form".equals(name) || "check-character-normalization".equals(name) || "datatype-normalization".equals(name) || "normalize-characters".equals(name) || "validate".equals(name) || "validate-if-schema".equals(name)) { return Boolean.FALSE; } else if ("namespaces".equals(name) || "well-formed".equals(name)) { return Boolean.TRUE; } else if ("infoset".equals(name)) { return (entities == false && cdataSections == false && namespaceDeclarations == true && comments == true) ? Boolean.TRUE : Boolean.FALSE; } throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR, name, null, 0); }
11,057
public void setParameter(String name, Object value) throws DOMException { name = name.toLowerCase(); if ("cdata-sections".equals(name)) { cdataSections = "true".equals(value.toString()); } else if ("comments".equals(name)) { comments = "true".equals(value.toString()); } else if ("element-content-whitespace".equals(name)) { elementContentWhitespace = "true".equals(value.toString()); } else if ("entities".equals(name)) { entities = "true".equals(value.toString()); } else if ("error-handler".equals(name)) { try { errorHandler = (DOMErrorHandler) value; } catch (ClassCastException e) { throw new DomEx(DomEx.TYPE_MISMATCH_ERR, value.getClass().getName(), null, 0); } } else if ("namespace-declarations".equals(name)) { namespaceDeclarations = "true".equals(value.toString()); } else if ("split-cdata-sections".equals(name)) { comments = "true".equals(value.toString()); } else if ("infoset".equals(name)) { if ("true".equals(value.toString())) { entities = false; cdataSections = false; namespaceDeclarations = true; elementContentWhitespace = true; comments = true; } } else if (("canonical-form".equals(name) || "check-character-normalization".equals(name) || "datatype-normalization".equals(name) || "normalize-characters".equals(name) || "validate".equals(name) || "validate-if-schema".equals(name)) && "false".equals(value.toString())) { // NOOP } else if (("namespaces".equals(name) || "well-formed".equals(name)) && "true".equals(value.toString())) { // NOOP } else { throw new DomEx(DomEx.NOT_SUPPORTED_ERR, name, null, 0); } }
public void setParameter(String name, Object value) throws DOMException { name = name.toLowerCase(); if ("cdata-sections".equals(name)) { cdataSections = "true".equals(value.toString()); } else if ("comments".equals(name)) { comments = "true".equals(value.toString()); } else if ("element-content-whitespace".equals(name)) { elementContentWhitespace = "true".equals(value.toString()); } else if ("entities".equals(name)) { entities = "true".equals(value.toString()); } else if ("error-handler".equals(name)) { try { errorHandler = (DOMErrorHandler) value; } catch (ClassCastException e) { throw new DomDOMException(DOMException.TYPE_MISMATCH_ERR, value.getClass().getName(), null, 0); } } else if ("namespace-declarations".equals(name)) { namespaceDeclarations = "true".equals(value.toString()); } else if ("split-cdata-sections".equals(name)) { comments = "true".equals(value.toString()); } else if ("infoset".equals(name)) { if ("true".equals(value.toString())) { entities = false; cdataSections = false; namespaceDeclarations = true; elementContentWhitespace = true; comments = true; } } else if (("canonical-form".equals(name) || "check-character-normalization".equals(name) || "datatype-normalization".equals(name) || "normalize-characters".equals(name) || "validate".equals(name) || "validate-if-schema".equals(name)) && "false".equals(value.toString())) { // NOOP } else if (("namespaces".equals(name) || "well-formed".equals(name)) && "true".equals(value.toString())) { // NOOP } else { throw new DomEx(DomEx.NOT_SUPPORTED_ERR, name, null, 0); } }
11,058
public void setParameter(String name, Object value) throws DOMException { name = name.toLowerCase(); if ("cdata-sections".equals(name)) { cdataSections = "true".equals(value.toString()); } else if ("comments".equals(name)) { comments = "true".equals(value.toString()); } else if ("element-content-whitespace".equals(name)) { elementContentWhitespace = "true".equals(value.toString()); } else if ("entities".equals(name)) { entities = "true".equals(value.toString()); } else if ("error-handler".equals(name)) { try { errorHandler = (DOMErrorHandler) value; } catch (ClassCastException e) { throw new DomEx(DomEx.TYPE_MISMATCH_ERR, value.getClass().getName(), null, 0); } } else if ("namespace-declarations".equals(name)) { namespaceDeclarations = "true".equals(value.toString()); } else if ("split-cdata-sections".equals(name)) { comments = "true".equals(value.toString()); } else if ("infoset".equals(name)) { if ("true".equals(value.toString())) { entities = false; cdataSections = false; namespaceDeclarations = true; elementContentWhitespace = true; comments = true; } } else if (("canonical-form".equals(name) || "check-character-normalization".equals(name) || "datatype-normalization".equals(name) || "normalize-characters".equals(name) || "validate".equals(name) || "validate-if-schema".equals(name)) && "false".equals(value.toString())) { // NOOP } else if (("namespaces".equals(name) || "well-formed".equals(name)) && "true".equals(value.toString())) { // NOOP } else { throw new DomEx(DomEx.NOT_SUPPORTED_ERR, name, null, 0); } }
public void setParameter(String name, Object value) throws DOMException { name = name.toLowerCase(); if ("cdata-sections".equals(name)) { cdataSections = "true".equals(value.toString()); } else if ("comments".equals(name)) { comments = "true".equals(value.toString()); } else if ("element-content-whitespace".equals(name)) { elementContentWhitespace = "true".equals(value.toString()); } else if ("entities".equals(name)) { entities = "true".equals(value.toString()); } else if ("error-handler".equals(name)) { try { errorHandler = (DOMErrorHandler) value; } catch (ClassCastException e) { throw new DomEx(DomEx.TYPE_MISMATCH_ERR, value.getClass().getName(), null, 0); } } else if ("namespace-declarations".equals(name)) { namespaceDeclarations = "true".equals(value.toString()); } else if ("split-cdata-sections".equals(name)) { comments = "true".equals(value.toString()); } else if ("infoset".equals(name)) { if ("true".equals(value.toString())) { entities = false; cdataSections = false; namespaceDeclarations = true; elementContentWhitespace = true; comments = true; } } else if (("canonical-form".equals(name) || "check-character-normalization".equals(name) || "datatype-normalization".equals(name) || "normalize-characters".equals(name) || "validate".equals(name) || "validate-if-schema".equals(name)) && "false".equals(value.toString())) { // NOOP } else if (("namespaces".equals(name) || "well-formed".equals(name)) && "true".equals(value.toString())) { // NOOP } else { throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR, name, null, 0); } }
11,059
public _NamingContextExtStub(Delegate delegate) { super(delegate); }
public _NamingContextExtStub() { super(delegate); }
11,060
public _NamingContextExtStub(Delegate delegate) { super(delegate); }
public _NamingContextExtStub(Delegate delegate) { super(); }
11,061
public Component getTreeCellEditorComponent(JTree tree, Object value, boolean isSelected, boolean expanded, boolean leaf, int row) { if (editorComponent instanceof JTextField) { ((JTextField)editorComponent).setText(value.toString()); delegate = new EditorDelegate(); ((JTextField)editorComponent).addActionListener(delegate); } else if (editorComponent instanceof JCheckBox) { ((JCheckBox)editorComponent).setText(value.toString()); delegate = new EditorDelegate(); ((JCheckBox)editorComponent).addActionListener(delegate); } else if (editorComponent instanceof JComboBox) { ((JComboBox)editorComponent).setSelectedItem(value.toString()); delegate = new EditorDelegate(); ((JComboBox)editorComponent).addActionListener(delegate); } return editorComponent; } // getTreeCellEditorComponent()
public Component getTreeCellEditorComponent(JTree tree, Object value, boolean isSelected, boolean expanded, boolean leaf, int row) { if (editorComponent instanceof JTextField) { ((JTextField)editorComponent).setText(value.toString()); delegate = new EditorDelegate(); ((JTextField)editorComponent).addActionListener(delegate); } else if (editorComponent instanceof JCheckBox) { ((JCheckBox)editorComponent).setText(value.toString()); delegate = new EditorDelegate(); ((JCheckBox)editorComponent).addActionListener(delegate); } else if (editorComponent instanceof JComboBox) { ((JComboBox)editorComponent).setSelectedItem(value.toString()); delegate = new EditorDelegate(); ((JComboBox)editorComponent).addActionListener(delegate); } return editorComponent; } // getTreeCellEditorComponent()
11,062
protected EntityReferenceImpl(Location location, //EntityDeclaration decl, String name, String baseUri, String publicId, String systemId, String replacementText) { super(location); //this.decl = decl; this.name = name; this.baseUri = baseUri; this.publicId = publicId; this.systemId = systemId; this.replacementText = replacementText; }
protected EntityReferenceImpl(Location location, //EntityDeclaration decl, String name, String baseUri, String publicId, String systemId, String replacementText) { super(location); //this.decl = decl; this.name = name; this.baseUri = baseUri; this.publicId = publicId; this.systemId = systemId; this.replacementText = replacementText; }
11,063
protected EntityReferenceImpl(Location location, //EntityDeclaration decl, String name, String baseUri, String publicId, String systemId, String replacementText) { super(location); //this.decl = decl; this.name = name; this.baseUri = baseUri; this.publicId = publicId; this.systemId = systemId; this.replacementText = replacementText; }
protected EntityReferenceImpl(Location location, //EntityDeclaration decl, String name, String baseUri, String publicId, String systemId, String replacementText) { super(location); //this.decl = decl; this.name = name; this.baseUri = baseUri; this.publicId = publicId; this.systemId = systemId; this.replacementText = replacementText; }
11,065
public AbstractFileSystem(Device device, boolean readOnly) throws FileSystemException { if (device == null) throw new IllegalArgumentException("null device!"); this.device = device; try { api = (BlockDeviceAPI) device.getAPI(BlockDeviceAPI.class); } catch (ApiNotFoundException e) { throw new FileSystemException("Device is not a partition!", e); } this.closed = false; this.readOnly = readOnly; }
public AbstractFileSystem(Device device, boolean readOnly) throws FileSystemException { if (device == null) throw new IllegalArgumentException("null device!"); this.device = device; try { api = device.getAPI(BlockDeviceAPI.class); } catch (ApiNotFoundException e) { throw new FileSystemException("Device is not a partition!", e); } this.closed = false; this.readOnly = readOnly; }
11,066
public void flush() throws IOException { log.debug("<<< BEGIN flush >>>"); flushFiles(); flushDirectories(); log.debug("<<< END flush >>>"); }
public void flush() throws IOException { flushFiles(); flushDirectories(); log.debug("<<< END flush >>>"); }
11,067
public void flush() throws IOException { log.debug("<<< BEGIN flush >>>"); flushFiles(); flushDirectories(); log.debug("<<< END flush >>>"); }
public void flush() throws IOException { log.debug("<<< BEGIN flush >>>"); flushFiles(); flushDirectories(); }
11,068
public synchronized void write(BlockDeviceAPI device, long offset) throws IOException { byte[] data = new byte[nrSectors * sectorSize]; for (int i = 0; i < entries.length; i++) { long v = entries[i]; switch (bitSize) { case 12 : { int idx = (int) (i * 1.5); if ((i % 2) == 0) { data[idx] = (byte) (v & 0xFF); data[idx + 1] = (byte) ((v >> 8) & 0x0F); } else { data[idx] |= (byte) ((v & 0x0F) << 4); data[idx + 1] = (byte) ((v >> 4) & 0xFF); } } break; case 16 : { int idx = i * 2; data[idx] = (byte) (v & 0xFF); data[idx + 1] = (byte) ((v >> 8) & 0xFF); } break; case 32 : { int idx = i * 4; data[idx] = (byte) (v & 0xFF); data[idx + 1] = (byte) ((v >> 8) & 0xFF); data[idx + 2] = (byte) ((v >> 16) & 0xFF); data[idx + 3] = (byte) ((v >> 24) & 0xFF); } break; } } device.write(offset, data, 0, data.length); this.dirty = false; }
public synchronized void write(BlockDeviceAPI device, long offset) throws IOException { byte[] data = new byte[nrSectors * sectorSize]; for (int i = 0; i < entries.length; i++) { long v = entries[i]; switch (bitSize) { case 12 : { int idx = (int) (i * 1.5); if ((i % 2) == 0) { data[idx] = (byte) (v & 0xFF); data[idx + 1] = (byte) ((v >> 8) & 0x0F); } else { data[idx] |= (byte) ((v & 0x0F) << 4); data[idx + 1] = (byte) ((v >> 4) & 0xFF); } } break; case 16 : { int idx = i << 1; data[idx] = (byte) (v & 0xFF); data[idx + 1] = (byte) ((v >> 8) & 0xFF); } break; case 32 : { int idx = i * 4; data[idx] = (byte) (v & 0xFF); data[idx + 1] = (byte) ((v >> 8) & 0xFF); data[idx + 2] = (byte) ((v >> 16) & 0xFF); data[idx + 3] = (byte) ((v >> 24) & 0xFF); } break; } } device.write(offset, data, 0, data.length); this.dirty = false; }
11,069
public synchronized void write(BlockDeviceAPI device, long offset) throws IOException { byte[] data = new byte[nrSectors * sectorSize]; for (int i = 0; i < entries.length; i++) { long v = entries[i]; switch (bitSize) { case 12 : { int idx = (int) (i * 1.5); if ((i % 2) == 0) { data[idx] = (byte) (v & 0xFF); data[idx + 1] = (byte) ((v >> 8) & 0x0F); } else { data[idx] |= (byte) ((v & 0x0F) << 4); data[idx + 1] = (byte) ((v >> 4) & 0xFF); } } break; case 16 : { int idx = i * 2; data[idx] = (byte) (v & 0xFF); data[idx + 1] = (byte) ((v >> 8) & 0xFF); } break; case 32 : { int idx = i * 4; data[idx] = (byte) (v & 0xFF); data[idx + 1] = (byte) ((v >> 8) & 0xFF); data[idx + 2] = (byte) ((v >> 16) & 0xFF); data[idx + 3] = (byte) ((v >> 24) & 0xFF); } break; } } device.write(offset, data, 0, data.length); this.dirty = false; }
public synchronized void write(BlockDeviceAPI device, long offset) throws IOException { byte[] data = new byte[nrSectors * sectorSize]; for (int i = 0; i < entries.length; i++) { long v = entries[i]; switch (bitSize) { case 12 : { int idx = (int) (i * 1.5); if ((i % 2) == 0) { data[idx] = (byte) (v & 0xFF); data[idx + 1] = (byte) ((v >> 8) & 0x0F); } else { data[idx] |= (byte) ((v & 0x0F) << 4); data[idx + 1] = (byte) ((v >> 4) & 0xFF); } } break; case 16 : { int idx = i * 2; data[idx] = (byte) (v & 0xFF); data[idx + 1] = (byte) ((v >> 8) & 0xFF); } break; case 32 : { int idx = i << 2; data[idx] = (byte) (v & 0xFF); data[idx + 1] = (byte) ((v >> 8) & 0xFF); data[idx + 2] = (byte) ((v >> 16) & 0xFF); data[idx + 3] = (byte) ((v >> 24) & 0xFF); } break; } } device.write(offset, data, 0, data.length); this.dirty = false; }
11,070
public FSEntry getRootEntry() throws IOException { log.debug("<<< BEGIN getRootEntry >>>"); if(isClosed()) throw new IOException("FileSystem is closed"); if(rootEntry == null) { rootEntry = createRootEntry(); } log.debug("<<< END getRootEntry >>>"); return rootEntry; }
public FSEntry getRootEntry() throws IOException { if(isClosed()) throw new IOException("FileSystem is closed"); if(rootEntry == null) { rootEntry = createRootEntry(); } log.debug("<<< END getRootEntry >>>"); return rootEntry; }
11,071
public FSEntry getRootEntry() throws IOException { log.debug("<<< BEGIN getRootEntry >>>"); if(isClosed()) throw new IOException("FileSystem is closed"); if(rootEntry == null) { rootEntry = createRootEntry(); } log.debug("<<< END getRootEntry >>>"); return rootEntry; }
public FSEntry getRootEntry() throws IOException { log.debug("<<< BEGIN getRootEntry >>>"); if(isClosed()) throw new IOException("FileSystem is closed"); if(rootEntry == null) { rootEntry = createRootEntry(); } return rootEntry; }
11,072
public void render(Graphics2D g, String text, int x, int y) { try { final GeneralPath gp = new GeneralPath(); gp.moveTo(x, y); final TTFGlyphTable glyphTable = fontData.getGlyphTable(); final TTFCMapTable cmapTable = fontData.getCMapTable(); final TTFHorizontalHeaderTable hheadTable = fontData.getHorizontalHeaderTable(); final TTFHorizontalMetricsTable hmTable = fontData.getHorizontalMetricsTable(); if (!(cmapTable.getNrEncodingTables() > 0)) { throw new RuntimeException("No Encoding is found!"); } final TTFCMapTable.EncodingTable encTable = cmapTable.getEncodingTable(0); if (encTable.getTableFormat() == null) { throw new RuntimeException("The table is NUll!!"); } final double ascent = hheadTable.getAscent(); final AffineTransform tx = new AffineTransform(); final double scale = fontSize / ascent; tx.translate(x, y + fontSize); tx.scale(scale, -scale); tx.translate(0, ascent); for (int i = 0; i < text.length(); i++) { // get the index for the needed glyph final int index = encTable.getTableFormat().getGlyphIndex(text.charAt(i)); Shape shape = glyphTable.getGlyph(index).getShape(); if(text.charAt(i) != ' ') gp.append(shape.getPathIterator(tx), false); tx.translate(hmTable.getAdvanceWidth(index), 0); } g.draw(gp); g.fill(gp); } catch (IOException ex) { log.error("Error drawing text", ex); } }
public void render(Graphics2D g, String text, int x, int y) { try { final GeneralPath gp = new GeneralPath(); gp.moveTo(x, y); final TTFGlyphTable glyphTable = fontData.getGlyphTable(); final TTFCMapTable cmapTable = fontData.getCMapTable(); final TTFHorizontalHeaderTable hheadTable = fontData.getHorizontalHeaderTable(); final TTFHorizontalMetricsTable hmTable = fontData.getHorizontalMetricsTable(); if (!(cmapTable.getNrEncodingTables() > 0)) { throw new RuntimeException("No Encoding is found!"); } final TTFCMapTable.EncodingTable encTable = cmapTable.getEncodingTable(0); if (encTable.getTableFormat() == null) { throw new RuntimeException("The table is NUll!!"); } final double ascent = hheadTable.getAscent(); final AffineTransform tx = new AffineTransform(); final double scale = fontSize / ascent; tx.translate(x, y + fontSize); tx.scale(scale, -scale); tx.translate(0, ascent); for (int i = 0; i < text.length(); i++) { // get the index for the needed glyph final int index = encTable.getTableFormat().getGlyphIndex(text.charAt(i)); Shape shape = glyphTable.getGlyph(index).getShape(); if(text.charAt(i) != ' ') gp.append(shape.getPathIterator(tx), false); tx.translate(hmTable.getAdvanceWidth(index), 0); } g.draw(gp); } catch (IOException ex) { log.error("Error drawing text", ex); } }
11,073
public LongSeqHolder(int[] initial_value) { value = initial_value; typecode.setLength(value.length); }
public LongSeqHolder() { value = initial_value; typecode.setLength(value.length); }
11,074
public LongSeqHolder(int[] initial_value) { value = initial_value; typecode.setLength(value.length); }
public LongSeqHolder(int[] initial_value) { value = initial_value; typecode.setLength(value.length); }
11,075
public ServantAlreadyActive(String why) { super(why); }
public ServantAlreadyActive() { super(why); }
11,076
public ServantAlreadyActive(String why) { super(why); }
public ServantAlreadyActive(String why) { }
11,077
JRootPane createRootPane() { return new JRootPane(); }
public JRootPane createRootPane() { return new JRootPane(); }
11,078
Component getGlassPane() { return getRootPane().getGlassPane(); }
public Component getGlassPane() { return getRootPane().getGlassPane(); }
11,079
JLayeredPane getLayeredPane() { return getRootPane().getLayeredPane(); }
public JLayeredPane getLayeredPane() { return getRootPane().getLayeredPane(); }
11,080
JRootPane getRootPane() { if (rootPane == null) setRootPane(createRootPane()); return rootPane; }
public JRootPane getRootPane() { if (rootPane == null) setRootPane(createRootPane()); return rootPane; }
11,081
void setGlassPane(Component glassPane) { getRootPane().setGlassPane(glassPane); }
public void setGlassPane(Component glassPane) { getRootPane().setGlassPane(glassPane); }
11,082
void setLayeredPane(JLayeredPane layeredPane) { getRootPane().setLayeredPane(layeredPane); }
public void setLayeredPane(JLayeredPane layeredPane) { getRootPane().setLayeredPane(layeredPane); }
11,083
void setRootPane(JRootPane root) { if (rootPane != null) remove(rootPane); rootPane = root; add(rootPane, BorderLayout.CENTER); }
public void setRootPane(JRootPane root) { if (rootPane != null) remove(rootPane); rootPane = root; add(rootPane, BorderLayout.CENTER); }
11,084
int binarySearch(int[] a, int key, int maxIndex) { int low = 0; int hi = maxIndex - 1; int mid = 0; while (low <= hi) { mid = (low + hi) >> 1; final int d = a[mid]; if (d == key) return mid; else if (d > key) hi = mid - 1; else // This gets the insertion point right on the last loop. low = ++mid; } return -mid - 1; }
int binarySearch(int[] a, int key, int maxIndex) { int low = 0; int hi = maxIndex - 1; int mid = 0; while (low <= hi) { mid = (low + hi) >>> 1; final int d = a[mid]; if (d == key) return mid; else if (d > key) hi = mid - 1; else // This gets the insertion point right on the last loop. low = ++mid; } return -mid - 1; }
11,085
private void dumpMarks() { System.err.print("positionMarks: "); for (int i = 0; i < positionMarks.length; i++) System.err.print(positionMarks[i] + ", "); System.err.println(); }
private void dumpMarks() { System.err.print("positionMarks: "); for (int i = 0; i < numMarks; i++) System.err.print(positionMarks[i] + ", "); System.err.println(); }
11,086
private void setPositionsInRange(int start, int end, boolean toStart) { // We slump together all the GapContentPositions to point to // one mark. So this is implemented as follows: // 1. Remove all the marks in the specified range. // 2. Insert one new mark at the correct location. // 3. Adjust all affected GapContentPosition instances to point to // this new mark. synchronized (this) { int startIndex = binarySearch(positionMarks, start, numMarks); if (startIndex < 0) // Translate to insertion index, if not found. startIndex = - startIndex - 1; int endIndex = binarySearch(positionMarks, end, numMarks); if (endIndex < 0) // Translate to insertion index - 1, if not found. endIndex = - endIndex - 2; // Update the marks. // We have inclusive interval bounds, but let one element over for // filling in the new value. int removed = endIndex - startIndex; if (removed <= 0) return; System.arraycopy(positionMarks, endIndex + 1, positionMarks, startIndex + 1, positionMarks.length - endIndex - 1); numMarks -= removed; if (toStart) { positionMarks[startIndex] = start; } else { positionMarks[startIndex] = end; } // Update all affected GapContentPositions to point to the new index // and all GapContentPositions that come after the interval to // have their index moved by -removed. Set positionSet = positions.keySet(); for (Iterator i = positionSet.iterator(); i.hasNext();) { GapContentPosition p = (GapContentPosition) i.next(); if (p.index > start || p.index <= end) p.index = start; else if (p.index > end) p.index -= removed; } } }
private void setPositionsInRange(int start, int end, boolean toStart) { // We slump together all the GapContentPositions to point to // one mark. So this is implemented as follows: // 1. Remove all the marks in the specified range. // 2. Insert one new mark at the correct location. // 3. Adjust all affected GapContentPosition instances to point to // this new mark. synchronized (this) { int startIndex = binarySearch(positionMarks, start, numMarks); if (startIndex < 0) // Translate to insertion index, if not found. startIndex = - startIndex - 1; int endIndex = binarySearch(positionMarks, end, numMarks); if (endIndex < 0) // Translate to insertion index - 1, if not found. endIndex = - endIndex - 2; // Update the marks. // We have inclusive interval bounds, but let one element over for // filling in the new value. int removed = endIndex - startIndex; if (removed <= 0) return; System.arraycopy(positionMarks, endIndex + 1, positionMarks, startIndex + 1, positionMarks.length - endIndex - 1); numMarks -= removed; if (toStart) { positionMarks[startIndex] = start; } else { positionMarks[startIndex] = end; } // Update all affected GapContentPositions to point to the new index // and all GapContentPositions that come after the interval to // have their index moved by -removed. Set positionSet = positions.keySet(); for (Iterator i = positionSet.iterator(); i.hasNext();) { GapContentPosition p = (GapContentPosition) i.next(); if (p.index > start || p.index <= end) p.index = start; else if (p.index > end) p.index -= removed; } } }
11,087
private short[] getCursor(HardwareCursor cursor) { final HardwareCursorImage img = cursor.getImage(32, 32); if (img == null) { return null; } short[] res = (short[]) cursorCache.get(img); if (res == null) { res = new short[1024]; final int[] argb = img.getImage(); for (int i = 0; i < 1024; i++) { final int v = argb[i]; final int a = (v >>> 24) & 0xFF; final int r = ((v >> 16) & 0xFF) >> 3; final int g = ((v >> 8) & 0xFF) >> 3; final int b = (v & 0xFF) >> 3; res[i] = (short) ((r << 10) | (g << 5) | b); if (a != 0) { res[i] |= 0x8000; } } cursorCache.put(img, res); } return res; }
private byte[] getCursor(HardwareCursor cursor) { final HardwareCursorImage img = cursor.getImage(32, 32); if (img == null) { return null; } short[] res = (short[]) cursorCache.get(img); if (res == null) { res = new short[1024]; final int[] argb = img.getImage(); for (int i = 0; i < 1024; i++) { final int v = argb[i]; final int a = (v >>> 24) & 0xFF; final int r = ((v >> 16) & 0xFF) >> 3; final int g = ((v >> 8) & 0xFF) >> 3; final int b = (v & 0xFF) >> 3; res[i] = (short) ((r << 10) | (g << 5) | b); if (a != 0) { res[i] |= 0x8000; } } cursorCache.put(img, res); } return res; }
11,088
private short[] getCursor(HardwareCursor cursor) { final HardwareCursorImage img = cursor.getImage(32, 32); if (img == null) { return null; } short[] res = (short[]) cursorCache.get(img); if (res == null) { res = new short[1024]; final int[] argb = img.getImage(); for (int i = 0; i < 1024; i++) { final int v = argb[i]; final int a = (v >>> 24) & 0xFF; final int r = ((v >> 16) & 0xFF) >> 3; final int g = ((v >> 8) & 0xFF) >> 3; final int b = (v & 0xFF) >> 3; res[i] = (short) ((r << 10) | (g << 5) | b); if (a != 0) { res[i] |= 0x8000; } } cursorCache.put(img, res); } return res; }
private short[] getCursor(HardwareCursor cursor) { final HardwareCursorImage img = cursor.getImage(32, 32); if (img == null) { return null; } final int w = img.getWidth(); final int h = img.getHeight(); horzOffset = 64 - w; vertOffset = 64 - h; byte[] res = (byte[]) cursorCache.get(img); if (res == null) { res = new short[1024]; final int[] argb = img.getImage(); for (int i = 0; i < 1024; i++) { final int v = argb[i]; final int a = (v >>> 24) & 0xFF; final int r = ((v >> 16) & 0xFF) >> 3; final int g = ((v >> 8) & 0xFF) >> 3; final int b = (v & 0xFF) >> 3; res[i] = (short) ((r << 10) | (g << 5) | b); if (a != 0) { res[i] |= 0x8000; } } cursorCache.put(img, res); } return res; }
11,089
private short[] getCursor(HardwareCursor cursor) { final HardwareCursorImage img = cursor.getImage(32, 32); if (img == null) { return null; } short[] res = (short[]) cursorCache.get(img); if (res == null) { res = new short[1024]; final int[] argb = img.getImage(); for (int i = 0; i < 1024; i++) { final int v = argb[i]; final int a = (v >>> 24) & 0xFF; final int r = ((v >> 16) & 0xFF) >> 3; final int g = ((v >> 8) & 0xFF) >> 3; final int b = (v & 0xFF) >> 3; res[i] = (short) ((r << 10) | (g << 5) | b); if (a != 0) { res[i] |= 0x8000; } } cursorCache.put(img, res); } return res; }
private short[] getCursor(HardwareCursor cursor) { final HardwareCursorImage img = cursor.getImage(32, 32); if (img == null) { return null; } short[] res = (short[]) cursorCache.get(img); if (res == null) { res = new byte[1024]; final int[] argb = img.getImage(); for (int i = 0; i < 1024; i++) { final int v = argb[i]; final int a = (v >>> 24) & 0xFF; final int r = ((v >> 16) & 0xFF) >> 3; final int g = ((v >> 8) & 0xFF) >> 3; final int b = (v & 0xFF) >> 3; res[i] = (short) ((r << 10) | (g << 5) | b); if (a != 0) { res[i] |= 0x8000; } } cursorCache.put(img, res); } return res; }
11,090
private short[] getCursor(HardwareCursor cursor) { final HardwareCursorImage img = cursor.getImage(32, 32); if (img == null) { return null; } short[] res = (short[]) cursorCache.get(img); if (res == null) { res = new short[1024]; final int[] argb = img.getImage(); for (int i = 0; i < 1024; i++) { final int v = argb[i]; final int a = (v >>> 24) & 0xFF; final int r = ((v >> 16) & 0xFF) >> 3; final int g = ((v >> 8) & 0xFF) >> 3; final int b = (v & 0xFF) >> 3; res[i] = (short) ((r << 10) | (g << 5) | b); if (a != 0) { res[i] |= 0x8000; } } cursorCache.put(img, res); } return res; }
private short[] getCursor(HardwareCursor cursor) { final HardwareCursorImage img = cursor.getImage(32, 32); if (img == null) { return null; } short[] res = (short[]) cursorCache.get(img); if (res == null) { res = new short[1024]; final int[] argb = img.getImage(); for (int i = 0; i < 1024; i++) { final int v = argb[i]; final int a = (v >>> 24) & 0xFF; final int r = ((v >> 16) & 0xFF) >> 3; final int g = ((v >> 8) & 0xFF) >> 3; final int b = (v & 0xFF) >> 3; res[i] = (short) ((r << 10) | (g << 5) | b); if (a != 0) { res[i] |= 0x8000; } } cursorCache.put(img, res); } return res; }
11,091
private short[] getCursor(HardwareCursor cursor) { final HardwareCursorImage img = cursor.getImage(32, 32); if (img == null) { return null; } short[] res = (short[]) cursorCache.get(img); if (res == null) { res = new short[1024]; final int[] argb = img.getImage(); for (int i = 0; i < 1024; i++) { final int v = argb[i]; final int a = (v >>> 24) & 0xFF; final int r = ((v >> 16) & 0xFF) >> 3; final int g = ((v >> 8) & 0xFF) >> 3; final int b = (v & 0xFF) >> 3; res[i] = (short) ((r << 10) | (g << 5) | b); if (a != 0) { res[i] |= 0x8000; } } cursorCache.put(img, res); } return res; }
private short[] getCursor(HardwareCursor cursor) { final HardwareCursorImage img = cursor.getImage(32, 32); if (img == null) { return null; } short[] res = (short[]) cursorCache.get(img); if (res == null) { res = new short[1024]; final int[] argb = img.getImage(); for (int i = 0; i < 1024; i++) { final int v = argb[i]; final int a = (v >>> 24) & 0xFF; final int r = ((v >> 16) & 0xFF) >> 3; final int g = ((v >> 8) & 0xFF) >> 3; final int b = (v & 0xFF) >> 3; res[i] = (short) ((r << 10) | (g << 5) | b); if (a != 0) { res[i] |= 0x8000; } } cursorCache.put(img, res); } return res; }
11,092
public void setCursorImage(HardwareCursor cursor) { // Background color io.setReg32(CUR_CLR0, 0xffffff); // Foreground color io.setReg32(CUR_CLR1, 0); // Set shape final short[] cur = getCursor(cursor); if (cur != null) { cursorMem.setShorts(cur, 0, 0, 1024); } }
public void setCursorImage(HardwareCursor cursor) { // Background color io.setReg32(CUR_CLR0, 0xffffff); // Foreground color io.setReg32(CUR_CLR1, 0); // Set shape final byte[] cur = getCursor(cursor); if (cur != null) { cursorMem.setShorts(cur, 0, 0, 1024); } }
11,093
public void setCursorImage(HardwareCursor cursor) { // Background color io.setReg32(CUR_CLR0, 0xffffff); // Foreground color io.setReg32(CUR_CLR1, 0); // Set shape final short[] cur = getCursor(cursor); if (cur != null) { cursorMem.setShorts(cur, 0, 0, 1024); } }
public void setCursorImage(HardwareCursor cursor) { // Background color io.setReg32(CUR_CLR0, 0xffffff); // Foreground color io.setReg32(CUR_CLR1, 0); // Set shape final short[] cur = getCursor(cursor); if (cur != null) { io.setReg32(CUR_HORZ_VERT_OFF, vertOffset + (horzOffset << 16)); cursorMem.setBytes(cur, 0, 0, 1024); } }
11,094
public void setCursorPosition(int x, int y) { // if upper-left corner of cursor is outside of // screen, we have to use special registers to clip it int xorigin = 0; int yorigin = 0; if( x < 0 ) { xorigin = -x; } if( y < 0 ) { yorigin = -y; } //Radeon_WaitForFifo( ai, 3 ); io.setReg32(CUR_HORZ_VERT_OFF, CUR_LOCK | (xorigin << 16) | yorigin ); io.setReg32(CUR_HORZ_VERT_POSN, CUR_LOCK | (((xorigin != 0) ? 0 : x) << 16) | ((yorigin != 0) ? 0 : y) ); io.setReg32(CUR_OFFSET, (int)cursorMem.getOffset() + xorigin + yorigin * 16 ); }
public void setCursorPosition(int x, int y) { // if upper-left corner of cursor is outside of // screen, we have to use special registers to clip it int xorigin = 0; int yorigin = 0; if( x < 0 ) { xorigin = -x; } if( y < 0 ) { yorigin = -y; } //Radeon_WaitForFifo( ai, 3 ); io.setReg32(CUR_HORZ_VERT_OFF, CUR_LOCK | (xorigin << 16) | yorigin ); io.setReg32(CUR_HORZ_VERT_POSN, CUR_LOCK | (((xorigin != 0) ? 0 : x) << 16) | ((yorigin != 0) ? 0 : y) ); io.setReg32(CUR_OFFSET, (int)cursorMem.getOffset() + xorigin + yorigin * 16 ); }
11,095
public void paint(Graphics g, JComponent c) { // FIXME: Move this to propertyChangeEvent handler, when we get those. leftToRightCache = slider.getComponentOrientation() != ComponentOrientation.RIGHT_TO_LEFT; // FIXME: This next line is only here because the above line is here. calculateThumbLocation(); if (slider.getPaintTrack()) paintTrack(g); if (slider.getPaintTicks()) paintTicks(g); if (slider.getPaintLabels()) paintLabels(g); //FIXME: Paint focus. paintThumb(g); }
public void paint(Graphics g, JComponent c) { // FIXME: Move this to propertyChangeEvent handler, when we get those. leftToRightCache = slider.getComponentOrientation() != ComponentOrientation.RIGHT_TO_LEFT; // FIXME: This next line is only here because the above line is here. calculateGeometry(); if (slider.getPaintTrack()) paintTrack(g); if (slider.getPaintTicks()) paintTicks(g); if (slider.getPaintLabels()) paintLabels(g); //FIXME: Paint focus. paintThumb(g); }
11,096
protected void paintComponent(Graphics g) { super.paintComponent(g); awtComponent.update(g); }
protected void paintComponent(Graphics g) { super.paintComponent(g); }
11,097
public AbstractAction(String name) { this(name, null); // TODO: default icon?? } // AbstractAction()
public AbstractAction(String name) { this(name, null); // TODO: default icon?? } // AbstractAction()
11,098
public void setContentAreaFilled(boolean b) { //Sets whether the button should paint the content area or leave it transparent. }
public void setContentAreaFilled(boolean b) { //Sets whether the button should paint the content area or leave it transparent. }
11,099
protected void installDefaults() { super.installDefaults(); UIDefaults defaults = UIManager.getLookAndFeelDefaults(); checkIcon = defaults.getIcon("CheckBoxMenuItem.checkIcon"); }
protected void installDefaults() { super.installDefaults(); UIDefaults defaults = UIManager.getLookAndFeelDefaults(); checkIcon = defaults.getIcon("CheckBoxMenuItem.checkIcon"); }
11,101
static public int[] getScanline (Reader in, int len) throws IOException { char byteStr[] = new char[2]; int scanline[] = new int[len]; int x = 0; while (x < len) { int ch = in.read (); if (ch == '0') { in.read (); // 'x' byteStr[0] = (char) in.read (); byteStr[1] = (char) in.read (); int byteVal = Integer.parseInt (new String (byteStr), 16); for (int i = 0; i < 8; i++, x++) { if (x == len) // condition occurs if bitmap is padded return scanline; scanline[x] = ((byteVal & masktable[i]) != 0) ? black : transparent; } } } return scanline; }
public static int[] getScanline (Reader in, int len) throws IOException { char byteStr[] = new char[2]; int scanline[] = new int[len]; int x = 0; while (x < len) { int ch = in.read (); if (ch == '0') { in.read (); // 'x' byteStr[0] = (char) in.read (); byteStr[1] = (char) in.read (); int byteVal = Integer.parseInt (new String (byteStr), 16); for (int i = 0; i < 8; i++, x++) { if (x == len) // condition occurs if bitmap is padded return scanline; scanline[x] = ((byteVal & masktable[i]) != 0) ? black : transparent; } } } return scanline; }
11,104
TemplateNode clone(Stylesheet stylesheet) { TemplateNode ret = new MessageNode(terminate); if (children != null) { ret.children = children.clone(stylesheet); } if (next != null) { ret.next = next.clone(stylesheet); } return ret; }
TemplateNode clone(Stylesheet stylesheet) TemplateNode ret = new MessageNode(terminate); if (children != null) ret.children = children.clone(stylesheet); } if (next != null) ret.next = next.clone(stylesheet); } return ret; }
11,105
TemplateNode clone(Stylesheet stylesheet) { TemplateNode ret = new MessageNode(terminate); if (children != null) { ret.children = children.clone(stylesheet); } if (next != null) { ret.next = next.clone(stylesheet); } return ret; }
TemplateNode clone(Stylesheet stylesheet) { TemplateNode ret = new MessageNode(terminate); if (children != null) { ret.children = children.clone(stylesheet); if (next != null) { ret.next = next.clone(stylesheet); return ret;
11,106
void doApply(Stylesheet stylesheet, QName mode, Node context, int pos, int len, Node parent, Node nextSibling) throws TransformerException { if (children != null) { Document doc = (parent instanceof Document) ? (Document) parent : parent.getOwnerDocument(); DocumentFragment fragment = doc.createDocumentFragment(); children.apply(stylesheet, mode, context, pos, len, fragment, null); String message = Expr.stringValue(fragment); System.err.println(message); if (terminate) { stylesheet.terminated = true; } } if (next != null && !terminate) { next.apply(stylesheet, mode, context, pos, len, parent, nextSibling); } }
void doApply(Stylesheet stylesheet, QName mode, Node context, int pos, int len, Node parent, Node nextSibling) throws TransformerException { if (children != null) { Document doc = (parent instanceof Document) ? (Document) parent : parent.getOwnerDocument(); DocumentFragment fragment = doc.createDocumentFragment(); children.apply(stylesheet, mode, context, pos, len, fragment, null); String message = Expr.stringValue(fragment); logger.info(message); if (terminate) { stylesheet.terminated = true; } } if (next != null && !terminate) { next.apply(stylesheet, mode, context, pos, len, parent, nextSibling); } }
11,107
void doApply(Stylesheet stylesheet, QName mode, Node context, int pos, int len, Node parent, Node nextSibling) throws TransformerException { if (children != null) { Document doc = (parent instanceof Document) ? (Document) parent : parent.getOwnerDocument(); DocumentFragment fragment = doc.createDocumentFragment(); children.apply(stylesheet, mode, context, pos, len, fragment, null); String message = Expr.stringValue(fragment); System.err.println(message); if (terminate) { stylesheet.terminated = true; } } if (next != null && !terminate) { next.apply(stylesheet, mode, context, pos, len, parent, nextSibling); } }
void doApply(Stylesheet stylesheet, QName mode, Node context, int pos, int len, Node parent, Node nextSibling) throws TransformerException if (children != null) Document doc = (parent instanceof Document) ? (Document) parent : parent.getOwnerDocument(); DocumentFragment fragment = doc.createDocumentFragment(); children.apply(stylesheet, mode, context, pos, len, fragment, null); String message = Expr.stringValue(fragment); System.err.println(message); if (terminate) stylesheet.terminated = true; } } if (next != null && !terminate) next.apply(stylesheet, mode, context, pos, len, parent, nextSibling); } }
11,108
void doApply(Stylesheet stylesheet, QName mode, Node context, int pos, int len, Node parent, Node nextSibling) throws TransformerException { if (children != null) { Document doc = (parent instanceof Document) ? (Document) parent : parent.getOwnerDocument(); DocumentFragment fragment = doc.createDocumentFragment(); children.apply(stylesheet, mode, context, pos, len, fragment, null); String message = Expr.stringValue(fragment); System.err.println(message); if (terminate) { stylesheet.terminated = true; } } if (next != null && !terminate) { next.apply(stylesheet, mode, context, pos, len, parent, nextSibling); } }
void doApply(Stylesheet stylesheet, QName mode, Node context, int pos, int len, Node parent, Node nextSibling) throws TransformerException { if (children != null) { Document doc = (parent instanceof Document) ? (Document) parent : parent.getOwnerDocument(); DocumentFragment fragment = doc.createDocumentFragment(); children.apply(stylesheet, mode, context, pos, len, fragment, null); String message = Expr.stringValue(fragment); System.err.println(message); if (terminate) { stylesheet.terminated = true; if (next != null && !terminate) { next.apply(stylesheet, mode, context, pos, len, parent, nextSibling);
11,109
private static int countSelections(ListSelectionModel lsm) { int lo = lsm.getMinSelectionIndex(); int hi = lsm.getMaxSelectionIndex(); int sum = 0; if (lo != -1 && hi != -1) { switch (lsm.getSelectionMode()) { case ListSelectionModel.SINGLE_SELECTION: sum = 1; break; case ListSelectionModel.SINGLE_INTERVAL_SELECTION: sum = hi - lo; break; case ListSelectionModel.MULTIPLE_INTERVAL_SELECTION: for (int i = lo; i < hi; ++i) if (lsm.isSelectedIndex(i)) ++sum; break; } } return sum; }
private static int countSelections(ListSelectionModel lsm) { int lo = lsm.getMinSelectionIndex(); int hi = lsm.getMaxSelectionIndex(); int sum = 0; if (lo != -1 && hi != -1) { switch (lsm.getSelectionMode()) { case ListSelectionModel.SINGLE_SELECTION: sum = 1; break; case ListSelectionModel.SINGLE_INTERVAL_SELECTION: sum = hi - lo + 1; break; case ListSelectionModel.MULTIPLE_INTERVAL_SELECTION: for (int i = lo; i < hi; ++i) if (lsm.isSelectedIndex(i)) ++sum; break; } } return sum; }
11,110
private static int countSelections(ListSelectionModel lsm) { int lo = lsm.getMinSelectionIndex(); int hi = lsm.getMaxSelectionIndex(); int sum = 0; if (lo != -1 && hi != -1) { switch (lsm.getSelectionMode()) { case ListSelectionModel.SINGLE_SELECTION: sum = 1; break; case ListSelectionModel.SINGLE_INTERVAL_SELECTION: sum = hi - lo; break; case ListSelectionModel.MULTIPLE_INTERVAL_SELECTION: for (int i = lo; i < hi; ++i) if (lsm.isSelectedIndex(i)) ++sum; break; } } return sum; }
private static int countSelections(ListSelectionModel lsm) { int lo = lsm.getMinSelectionIndex(); int hi = lsm.getMaxSelectionIndex(); int sum = 0; if (lo != -1 && hi != -1) { switch (lsm.getSelectionMode()) { case ListSelectionModel.SINGLE_SELECTION: sum = 1; break; case ListSelectionModel.SINGLE_INTERVAL_SELECTION: sum = hi - lo; break; case ListSelectionModel.MULTIPLE_INTERVAL_SELECTION: for (int i = lo; i <= hi; ++i) if (lsm.isSelectedIndex(i)) ++sum; break; } } return sum; }
11,111
private static int[] getSelections(ListSelectionModel lsm) { int sz = countSelections(lsm); int [] ret = new int[sz]; int lo = lsm.getMinSelectionIndex(); int hi = lsm.getMaxSelectionIndex(); int j = 0; java.util.ArrayList ls = new java.util.ArrayList(); if (lo != -1 && hi != -1) { switch (lsm.getSelectionMode()) { case ListSelectionModel.SINGLE_SELECTION: ret[0] = lo; break; case ListSelectionModel.SINGLE_INTERVAL_SELECTION: for (int i = lo; i < hi; ++i) ret[j++] = i; break; case ListSelectionModel.MULTIPLE_INTERVAL_SELECTION: for (int i = lo; i < hi; ++i) if (lsm.isSelectedIndex(i)) ret[j++] = i; break; } } return ret; }
private static int[] getSelections(ListSelectionModel lsm) { int sz = countSelections(lsm); int [] ret = new int[sz]; int lo = lsm.getMinSelectionIndex(); int hi = lsm.getMaxSelectionIndex(); int j = 0; java.util.ArrayList ls = new java.util.ArrayList(); if (lo != -1 && hi != -1) { switch (lsm.getSelectionMode()) { case ListSelectionModel.SINGLE_SELECTION: ret[0] = lo; break; case ListSelectionModel.SINGLE_INTERVAL_SELECTION: for (int i = lo; i <= hi; ++i) ret[j++] = i; break; case ListSelectionModel.MULTIPLE_INTERVAL_SELECTION: for (int i = lo; i <= hi; ++i) if (lsm.isSelectedIndex(i)) ret[j++] = i; break; } } return ret; }
11,112
public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException { String FEATURES = "http://xml.org/sax/features/"; String PROPERTIES = "http://xml.org/sax/properties/"; if ((FEATURES + "is-standalone").equals(name)) return xmlStandalone ? Boolean.TRUE : Boolean.FALSE; if ((FEATURES + "namespaces").equals(name)) return namespaceAware ? Boolean.TRUE : Boolean.FALSE; if ((FEATURES + "string-interning").equals(name)) return stringInterning ? Boolean.TRUE : Boolean.FALSE; if ((FEATURES + "use-attributes2").equals(name)) return Boolean.TRUE; if ((FEATURES + "use-locator2").equals(name)) return Boolean.TRUE; if ((FEATURES + "use-entity-resolver2").equals(name)) return Boolean.FALSE; if ((FEATURES + "validation").equals(name)) return validating ? Boolean.TRUE : Boolean.FALSE; if ((FEATURES + "external-general-entities").equals(name)) return externalEntities ? Boolean.TRUE : Boolean.FALSE; if ((FEATURES + "external-parameter-entities").equals(name)) return externalEntities ? Boolean.TRUE : Boolean.FALSE; if ((FEATURES + "xml-1.1").equals(name)) return Boolean.TRUE; if ((PROPERTIES + "declaration-handler").equals(name)) return declHandler; if ((PROPERTIES + "document-xml-version").equals(name)) return xmlVersion; if ((PROPERTIES + "lexical-handler").equals(name)) return lexicalHandler; throw new SAXNotSupportedException(name); }
public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException { String FEATURES = "http://xml.org/sax/features/"; String PROPERTIES = "http://xml.org/sax/properties/"; if ((FEATURES + "is-standalone").equals(name)) return xmlStandalone ? Boolean.TRUE : Boolean.FALSE; if ((FEATURES + "namespaces").equals(name)) return namespaceAware ? Boolean.TRUE : Boolean.FALSE; if ((FEATURES + "string-interning").equals(name)) return stringInterning ? Boolean.TRUE : Boolean.FALSE; if ((FEATURES + "use-attributes2").equals(name)) return Boolean.TRUE; if ((FEATURES + "use-locator2").equals(name)) return Boolean.TRUE; if ((FEATURES + "use-entity-resolver2").equals(name)) return Boolean.FALSE; if ((FEATURES + "validation").equals(name)) return validating ? Boolean.TRUE : Boolean.FALSE; if ((FEATURES + "external-general-entities").equals(name)) return externalEntities ? Boolean.TRUE : Boolean.FALSE; if ((FEATURES + "external-parameter-entities").equals(name)) return externalEntities ? Boolean.TRUE : Boolean.FALSE; if ((FEATURES + "xml-1.1").equals(name)) return Boolean.TRUE; if ((PROPERTIES + "declaration-handler").equals(name)) return declHandler; if ((PROPERTIES + "document-xml-version").equals(name)) return xmlVersion; if ((PROPERTIES + "lexical-handler").equals(name)) return lexicalHandler; throw new SAXNotSupportedException(name); }
11,114
public synchronized void parse(InputSource input) throws IOException, SAXException { reset(); String systemId = input.getSystemId(); InputStream in = input.getByteStream(); boolean opened = false; if (in != null) parser = new XMLParser(in, systemId, validating, namespaceAware, coalescing, replaceERefs, externalEntities, supportDTD, baseAware, stringInterning, this, this); else { Reader r = input.getCharacterStream(); if (r != null) parser = new XMLParser(r, systemId, validating, namespaceAware, coalescing, replaceERefs, externalEntities, supportDTD, baseAware, stringInterning, this, this); } if (parser == null) { if (systemId == null) throw new SAXException("No stream or system ID specified"); systemId = XMLParser.absolutize(null, systemId); in = new URL(systemId).openStream(); opened = true; parser = new XMLParser(in, systemId, validating, namespaceAware, coalescing, replaceERefs, externalEntities, supportDTD, baseAware, stringInterning, this, this); } reader = parser; if (xIncludeAware) reader = new XIncludeFilter(parser, systemId, namespaceAware, validating, true); if (contentHandler != null) contentHandler.setDocumentLocator(this); boolean startDocumentDone = false; try { while (parser.hasNext()) { switch (parser.next()) { case XMLStreamConstants.CHARACTERS: if (contentHandler != null) { char[] b = reader.getTextCharacters(); contentHandler.characters(b, 0, b.length); } break; case XMLStreamConstants.SPACE: if (contentHandler != null) { char[] b = reader.getTextCharacters(); // TODO determine whether whitespace is ignorable contentHandler.characters(b, 0, b.length); } break; case XMLStreamConstants.CDATA: if (lexicalHandler != null) lexicalHandler.startCDATA(); if (contentHandler != null) { char[] b = reader.getTextCharacters(); // TODO determine whether whitespace and ignorable contentHandler.characters(b, 0, b.length); } if (lexicalHandler != null) lexicalHandler.endCDATA(); break; case XMLStreamConstants.START_ELEMENT: if (contentHandler != null) { QName name = reader.getName(); String uri = name.getNamespaceURI(); String localName = name.getLocalPart(); String prefix = name.getPrefix(); String qName = localName; if (!"".equals(prefix)) qName = prefix + ":" + localName; if (!namespaceAware) { uri = ""; localName = ""; } else { int nc = reader.getNamespaceCount(); for (int i = 0; i < nc; i++) { String nsuri = reader.getNamespaceURI(i); String nsprefix = reader.getNamespacePrefix(i); contentHandler.startPrefixMapping(nsprefix, nsuri); } } contentHandler.startElement(uri, localName, qName, this); } break; case XMLStreamConstants.END_ELEMENT: if (contentHandler != null) { QName name = reader.getName(); String uri = name.getNamespaceURI(); String localName = name.getLocalPart(); String prefix = name.getPrefix(); String qName = localName; if (!"".equals(prefix)) qName = prefix + ":" + localName; if (!namespaceAware) { uri = ""; localName = ""; } contentHandler.endElement(uri, localName, qName); if (namespaceAware) { int nc = reader.getNamespaceCount(); for (int i = 0; i < nc; i++) { String nsprefix = reader.getNamespacePrefix(i); contentHandler.endPrefixMapping(nsprefix); } } } break; case XMLStreamConstants.COMMENT: if (lexicalHandler != null) { char[] b = reader.getTextCharacters(); lexicalHandler.comment(b, 0, b.length); } break; case XMLStreamConstants.PROCESSING_INSTRUCTION: if (contentHandler != null) { String target = reader.getPITarget(); String data = reader.getPIData(); if (data == null) data = ""; contentHandler.processingInstruction(target, data); } break; case XMLStreamConstants.START_DOCUMENT: encoding = reader.getEncoding(); xmlVersion = reader.getVersion(); xmlStandalone = reader.isStandalone(); if (contentHandler != null) contentHandler.startDocument(); startDocumentDone = true; break; case XMLStreamConstants.END_DOCUMENT: if (contentHandler != null) contentHandler.endDocument(); break; case XMLStreamConstants.DTD: XMLParser.Doctype doctype = parser.doctype; if (lexicalHandler != null) { String rootName = doctype.rootName; String publicId = doctype.publicId; String systemId2 = doctype.systemId; lexicalHandler.startDTD(rootName, publicId, systemId2); } for (Iterator i = doctype.entryIterator(); i.hasNext(); ) { String entry = (String) i.next(); char c = entry.charAt(0); String name = entry.substring(1); if ('E' == c) { // Element decl if (declHandler != null) { String model = doctype.getElementModel(name); declHandler.elementDecl(name, model); } } else if ('A' == c) { // Attlist decl if (declHandler != null) { for (Iterator j = doctype.attlistIterator(name); j.hasNext(); ) { Map.Entry att = (Map.Entry) j.next(); String aname = (String) att.getKey(); XMLParser.AttributeDecl decl = (XMLParser.AttributeDecl) att.getValue(); String type = decl.type; String value = decl.value; String mode = null; switch (decl.valueType) { case XMLParser.ATTRIBUTE_DEFAULT_FIXED: mode = "#FIXED"; break; case XMLParser.ATTRIBUTE_DEFAULT_REQUIRED: mode = "#REQUIRED"; break; case XMLParser.ATTRIBUTE_DEFAULT_IMPLIED: mode = "#IMPLIED"; break; } declHandler.attributeDecl(name, aname, type, mode, value); } } } else if ('e' == c) { // Entity decl Object entity = doctype.getEntity(name); if (entity instanceof String) { if (declHandler != null) declHandler.internalEntityDecl(name, (String) entity); } else { XMLParser.ExternalIds ids = (XMLParser.ExternalIds) entity; if (ids.notationName != null) { if (dtdHandler != null) { String pub = ids.publicId; String url = ids.systemId; String not = ids.notationName; dtdHandler.unparsedEntityDecl(name, pub, url, not); } } else { if (declHandler != null) { String pub = ids.publicId; String url = ids.systemId; declHandler.externalEntityDecl(name, pub, url); } } } } else if ('n' == c) { // Notation decl if (dtdHandler != null) { XMLParser.ExternalIds ids = doctype.getNotation(name); String pub = ids.publicId; String url = ids.systemId; dtdHandler.notationDecl(name, pub, url); } } } if (lexicalHandler != null) lexicalHandler.endDTD(); } } } catch (XMLStreamException e) { if (!startDocumentDone && contentHandler != null) contentHandler.startDocument(); SAXParseException e2 = new SAXParseException(e.getMessage(), this); e2.initCause(e); if (errorHandler != null) errorHandler.fatalError(e2); if (contentHandler != null) contentHandler.endDocument(); throw e2; } finally { if (opened) in.close(); reset(); } }
public synchronized void parse(InputSource input) throws IOException, SAXException { reset(); String systemId = input.getSystemId(); InputStream in = input.getByteStream(); boolean opened = false; if (in != null) parser = new XMLParser(in, systemId, validating, namespaceAware, coalescing, replaceERefs, externalEntities, supportDTD, baseAware, stringInterning, this, this); else { Reader r = input.getCharacterStream(); if (r != null) parser = new XMLParser(r, systemId, validating, namespaceAware, coalescing, replaceERefs, externalEntities, supportDTD, baseAware, stringInterning, this, this); } if (parser == null) { if (systemId == null) throw new SAXException("No stream or system ID specified"); systemId = XMLParser.absolutize(null, systemId); in = new URL(systemId).openStream(); opened = true; parser = new XMLParser(in, systemId, validating, namespaceAware, coalescing, replaceERefs, externalEntities, supportDTD, baseAware, stringInterning, this, this); } reader = parser; if (xIncludeAware) reader = new XIncludeFilter(parser, systemId, namespaceAware, validating, true); if (contentHandler != null) contentHandler.setDocumentLocator(this); boolean startDocumentDone = false; try { while (parser.hasNext()) { int event = parser.next(); if (baseAware) baseURI = parser.getXMLBase(); switch (event) { case XMLStreamConstants.CHARACTERS: if (contentHandler != null) { char[] b = reader.getTextCharacters(); contentHandler.characters(b, 0, b.length); } break; case XMLStreamConstants.SPACE: if (contentHandler != null) { char[] b = reader.getTextCharacters(); // TODO determine whether whitespace is ignorable contentHandler.characters(b, 0, b.length); } break; case XMLStreamConstants.CDATA: if (lexicalHandler != null) lexicalHandler.startCDATA(); if (contentHandler != null) { char[] b = reader.getTextCharacters(); // TODO determine whether whitespace and ignorable contentHandler.characters(b, 0, b.length); } if (lexicalHandler != null) lexicalHandler.endCDATA(); break; case XMLStreamConstants.START_ELEMENT: if (contentHandler != null) { QName name = reader.getName(); String uri = name.getNamespaceURI(); String localName = name.getLocalPart(); String prefix = name.getPrefix(); String qName = localName; if (!"".equals(prefix)) qName = prefix + ":" + localName; if (!namespaceAware) { uri = ""; localName = ""; } else { int nc = reader.getNamespaceCount(); for (int i = 0; i < nc; i++) { String nsuri = reader.getNamespaceURI(i); String nsprefix = reader.getNamespacePrefix(i); contentHandler.startPrefixMapping(nsprefix, nsuri); } } contentHandler.startElement(uri, localName, qName, this); } break; case XMLStreamConstants.END_ELEMENT: if (contentHandler != null) { QName name = reader.getName(); String uri = name.getNamespaceURI(); String localName = name.getLocalPart(); String prefix = name.getPrefix(); String qName = localName; if (!"".equals(prefix)) qName = prefix + ":" + localName; if (!namespaceAware) { uri = ""; localName = ""; } contentHandler.endElement(uri, localName, qName); if (namespaceAware) { int nc = reader.getNamespaceCount(); for (int i = 0; i < nc; i++) { String nsprefix = reader.getNamespacePrefix(i); contentHandler.endPrefixMapping(nsprefix); } } } break; case XMLStreamConstants.COMMENT: if (lexicalHandler != null) { char[] b = reader.getTextCharacters(); lexicalHandler.comment(b, 0, b.length); } break; case XMLStreamConstants.PROCESSING_INSTRUCTION: if (contentHandler != null) { String target = reader.getPITarget(); String data = reader.getPIData(); if (data == null) data = ""; contentHandler.processingInstruction(target, data); } break; case XMLStreamConstants.START_DOCUMENT: encoding = reader.getEncoding(); xmlVersion = reader.getVersion(); xmlStandalone = reader.isStandalone(); if (contentHandler != null) contentHandler.startDocument(); startDocumentDone = true; break; case XMLStreamConstants.END_DOCUMENT: if (contentHandler != null) contentHandler.endDocument(); break; case XMLStreamConstants.DTD: XMLParser.Doctype doctype = parser.doctype; if (lexicalHandler != null) { String rootName = doctype.rootName; String publicId = doctype.publicId; String systemId2 = doctype.systemId; lexicalHandler.startDTD(rootName, publicId, systemId2); } for (Iterator i = doctype.entryIterator(); i.hasNext(); ) { String entry = (String) i.next(); char c = entry.charAt(0); String name = entry.substring(1); if ('E' == c) { // Element decl if (declHandler != null) { String model = doctype.getElementModel(name); declHandler.elementDecl(name, model); } } else if ('A' == c) { // Attlist decl if (declHandler != null) { for (Iterator j = doctype.attlistIterator(name); j.hasNext(); ) { Map.Entry att = (Map.Entry) j.next(); String aname = (String) att.getKey(); XMLParser.AttributeDecl decl = (XMLParser.AttributeDecl) att.getValue(); String type = decl.type; String value = decl.value; String mode = null; switch (decl.valueType) { case XMLParser.ATTRIBUTE_DEFAULT_FIXED: mode = "#FIXED"; break; case XMLParser.ATTRIBUTE_DEFAULT_REQUIRED: mode = "#REQUIRED"; break; case XMLParser.ATTRIBUTE_DEFAULT_IMPLIED: mode = "#IMPLIED"; break; } declHandler.attributeDecl(name, aname, type, mode, value); } } } else if ('e' == c) { // Entity decl Object entity = doctype.getEntity(name); if (entity instanceof String) { if (declHandler != null) declHandler.internalEntityDecl(name, (String) entity); } else { XMLParser.ExternalIds ids = (XMLParser.ExternalIds) entity; if (ids.notationName != null) { if (dtdHandler != null) { String pub = ids.publicId; String url = ids.systemId; String not = ids.notationName; dtdHandler.unparsedEntityDecl(name, pub, url, not); } } else { if (declHandler != null) { String pub = ids.publicId; String url = ids.systemId; declHandler.externalEntityDecl(name, pub, url); } } } } else if ('n' == c) { // Notation decl if (dtdHandler != null) { XMLParser.ExternalIds ids = doctype.getNotation(name); String pub = ids.publicId; String url = ids.systemId; dtdHandler.notationDecl(name, pub, url); } } } if (lexicalHandler != null) lexicalHandler.endDTD(); } } } catch (XMLStreamException e) { if (!startDocumentDone && contentHandler != null) contentHandler.startDocument(); SAXParseException e2 = new SAXParseException(e.getMessage(), this); e2.initCause(e); if (errorHandler != null) errorHandler.fatalError(e2); if (contentHandler != null) contentHandler.endDocument(); throw e2; } finally { if (opened) in.close(); reset(); } }
11,116
public synchronized void parse(InputSource input) throws IOException, SAXException { reset(); String systemId = input.getSystemId(); InputStream in = input.getByteStream(); boolean opened = false; if (in != null) parser = new XMLParser(in, systemId, validating, namespaceAware, coalescing, replaceERefs, externalEntities, supportDTD, baseAware, stringInterning, this, this); else { Reader r = input.getCharacterStream(); if (r != null) parser = new XMLParser(r, systemId, validating, namespaceAware, coalescing, replaceERefs, externalEntities, supportDTD, baseAware, stringInterning, this, this); } if (parser == null) { if (systemId == null) throw new SAXException("No stream or system ID specified"); systemId = XMLParser.absolutize(null, systemId); in = new URL(systemId).openStream(); opened = true; parser = new XMLParser(in, systemId, validating, namespaceAware, coalescing, replaceERefs, externalEntities, supportDTD, baseAware, stringInterning, this, this); } reader = parser; if (xIncludeAware) reader = new XIncludeFilter(parser, systemId, namespaceAware, validating, true); if (contentHandler != null) contentHandler.setDocumentLocator(this); boolean startDocumentDone = false; try { while (parser.hasNext()) { switch (parser.next()) { case XMLStreamConstants.CHARACTERS: if (contentHandler != null) { char[] b = reader.getTextCharacters(); contentHandler.characters(b, 0, b.length); } break; case XMLStreamConstants.SPACE: if (contentHandler != null) { char[] b = reader.getTextCharacters(); // TODO determine whether whitespace is ignorable contentHandler.characters(b, 0, b.length); } break; case XMLStreamConstants.CDATA: if (lexicalHandler != null) lexicalHandler.startCDATA(); if (contentHandler != null) { char[] b = reader.getTextCharacters(); // TODO determine whether whitespace and ignorable contentHandler.characters(b, 0, b.length); } if (lexicalHandler != null) lexicalHandler.endCDATA(); break; case XMLStreamConstants.START_ELEMENT: if (contentHandler != null) { QName name = reader.getName(); String uri = name.getNamespaceURI(); String localName = name.getLocalPart(); String prefix = name.getPrefix(); String qName = localName; if (!"".equals(prefix)) qName = prefix + ":" + localName; if (!namespaceAware) { uri = ""; localName = ""; } else { int nc = reader.getNamespaceCount(); for (int i = 0; i < nc; i++) { String nsuri = reader.getNamespaceURI(i); String nsprefix = reader.getNamespacePrefix(i); contentHandler.startPrefixMapping(nsprefix, nsuri); } } contentHandler.startElement(uri, localName, qName, this); } break; case XMLStreamConstants.END_ELEMENT: if (contentHandler != null) { QName name = reader.getName(); String uri = name.getNamespaceURI(); String localName = name.getLocalPart(); String prefix = name.getPrefix(); String qName = localName; if (!"".equals(prefix)) qName = prefix + ":" + localName; if (!namespaceAware) { uri = ""; localName = ""; } contentHandler.endElement(uri, localName, qName); if (namespaceAware) { int nc = reader.getNamespaceCount(); for (int i = 0; i < nc; i++) { String nsprefix = reader.getNamespacePrefix(i); contentHandler.endPrefixMapping(nsprefix); } } } break; case XMLStreamConstants.COMMENT: if (lexicalHandler != null) { char[] b = reader.getTextCharacters(); lexicalHandler.comment(b, 0, b.length); } break; case XMLStreamConstants.PROCESSING_INSTRUCTION: if (contentHandler != null) { String target = reader.getPITarget(); String data = reader.getPIData(); if (data == null) data = ""; contentHandler.processingInstruction(target, data); } break; case XMLStreamConstants.START_DOCUMENT: encoding = reader.getEncoding(); xmlVersion = reader.getVersion(); xmlStandalone = reader.isStandalone(); if (contentHandler != null) contentHandler.startDocument(); startDocumentDone = true; break; case XMLStreamConstants.END_DOCUMENT: if (contentHandler != null) contentHandler.endDocument(); break; case XMLStreamConstants.DTD: XMLParser.Doctype doctype = parser.doctype; if (lexicalHandler != null) { String rootName = doctype.rootName; String publicId = doctype.publicId; String systemId2 = doctype.systemId; lexicalHandler.startDTD(rootName, publicId, systemId2); } for (Iterator i = doctype.entryIterator(); i.hasNext(); ) { String entry = (String) i.next(); char c = entry.charAt(0); String name = entry.substring(1); if ('E' == c) { // Element decl if (declHandler != null) { String model = doctype.getElementModel(name); declHandler.elementDecl(name, model); } } else if ('A' == c) { // Attlist decl if (declHandler != null) { for (Iterator j = doctype.attlistIterator(name); j.hasNext(); ) { Map.Entry att = (Map.Entry) j.next(); String aname = (String) att.getKey(); XMLParser.AttributeDecl decl = (XMLParser.AttributeDecl) att.getValue(); String type = decl.type; String value = decl.value; String mode = null; switch (decl.valueType) { case XMLParser.ATTRIBUTE_DEFAULT_FIXED: mode = "#FIXED"; break; case XMLParser.ATTRIBUTE_DEFAULT_REQUIRED: mode = "#REQUIRED"; break; case XMLParser.ATTRIBUTE_DEFAULT_IMPLIED: mode = "#IMPLIED"; break; } declHandler.attributeDecl(name, aname, type, mode, value); } } } else if ('e' == c) { // Entity decl Object entity = doctype.getEntity(name); if (entity instanceof String) { if (declHandler != null) declHandler.internalEntityDecl(name, (String) entity); } else { XMLParser.ExternalIds ids = (XMLParser.ExternalIds) entity; if (ids.notationName != null) { if (dtdHandler != null) { String pub = ids.publicId; String url = ids.systemId; String not = ids.notationName; dtdHandler.unparsedEntityDecl(name, pub, url, not); } } else { if (declHandler != null) { String pub = ids.publicId; String url = ids.systemId; declHandler.externalEntityDecl(name, pub, url); } } } } else if ('n' == c) { // Notation decl if (dtdHandler != null) { XMLParser.ExternalIds ids = doctype.getNotation(name); String pub = ids.publicId; String url = ids.systemId; dtdHandler.notationDecl(name, pub, url); } } } if (lexicalHandler != null) lexicalHandler.endDTD(); } } } catch (XMLStreamException e) { if (!startDocumentDone && contentHandler != null) contentHandler.startDocument(); SAXParseException e2 = new SAXParseException(e.getMessage(), this); e2.initCause(e); if (errorHandler != null) errorHandler.fatalError(e2); if (contentHandler != null) contentHandler.endDocument(); throw e2; } finally { if (opened) in.close(); reset(); } }
public synchronized void parse(InputSource input) throws IOException, SAXException { reset(); String systemId = input.getSystemId(); InputStream in = input.getByteStream(); boolean opened = false; if (in != null) parser = new XMLParser(in, systemId, validating, namespaceAware, coalescing, replaceERefs, externalEntities, supportDTD, baseAware, stringInterning, this, this); else { Reader r = input.getCharacterStream(); if (r != null) parser = new XMLParser(r, systemId, validating, namespaceAware, coalescing, replaceERefs, externalEntities, supportDTD, baseAware, stringInterning, this, this); } if (parser == null) { if (systemId == null) throw new SAXException("No stream or system ID specified"); systemId = XMLParser.absolutize(null, systemId); in = new URL(systemId).openStream(); opened = true; parser = new XMLParser(in, systemId, validating, namespaceAware, coalescing, replaceERefs, externalEntities, supportDTD, baseAware, stringInterning, this, this); } reader = parser; if (xIncludeAware) reader = new XIncludeFilter(parser, systemId, namespaceAware, validating, true); if (contentHandler != null) contentHandler.setDocumentLocator(this); boolean startDocumentDone = false; try { while (parser.hasNext()) { switch (parser.next()) { case XMLStreamConstants.CHARACTERS: if (contentHandler != null) { char[] b = reader.getTextCharacters(); contentHandler.characters(b, 0, b.length); } break; case XMLStreamConstants.SPACE: if (contentHandler != null) { char[] b = reader.getTextCharacters(); // TODO determine whether whitespace is ignorable contentHandler.characters(b, 0, b.length); } break; case XMLStreamConstants.CDATA: if (lexicalHandler != null) lexicalHandler.startCDATA(); if (contentHandler != null) { char[] b = reader.getTextCharacters(); // TODO determine whether whitespace and ignorable contentHandler.characters(b, 0, b.length); } if (lexicalHandler != null) lexicalHandler.endCDATA(); break; case XMLStreamConstants.START_ELEMENT: if (contentHandler != null) { QName name = reader.getName(); String uri = name.getNamespaceURI(); String localName = name.getLocalPart(); String prefix = name.getPrefix(); String qName = localName; if (!"".equals(prefix)) qName = prefix + ":" + localName; if (!namespaceAware) { uri = ""; localName = ""; } else { int nc = reader.getNamespaceCount(); for (int i = 0; i < nc; i++) { String nsuri = reader.getNamespaceURI(i); String nsprefix = reader.getNamespacePrefix(i); contentHandler.startPrefixMapping(nsprefix, nsuri); } } contentHandler.startElement(uri, localName, qName, this); } break; case XMLStreamConstants.END_ELEMENT: if (contentHandler != null) { QName name = reader.getName(); String uri = name.getNamespaceURI(); String localName = name.getLocalPart(); String prefix = name.getPrefix(); String qName = localName; if (!"".equals(prefix)) qName = prefix + ":" + localName; if (!namespaceAware) { uri = ""; localName = ""; } contentHandler.endElement(uri, localName, qName); if (namespaceAware) { int nc = reader.getNamespaceCount(); for (int i = 0; i < nc; i++) { String nsprefix = reader.getNamespacePrefix(i); contentHandler.endPrefixMapping(nsprefix); } } } break; case XMLStreamConstants.COMMENT: if (lexicalHandler != null) { char[] b = reader.getTextCharacters(); lexicalHandler.comment(b, 0, b.length); } break; case XMLStreamConstants.PROCESSING_INSTRUCTION: if (contentHandler != null) { String target = reader.getPITarget(); String data = reader.getPIData(); if (data == null) data = ""; contentHandler.processingInstruction(target, data); } break; case XMLStreamConstants.START_DOCUMENT: encoding = reader.getEncoding(); xmlVersion = reader.getVersion(); xmlStandalone = reader.isStandalone(); if (contentHandler != null) contentHandler.startDocument(); startDocumentDone = true; break; case XMLStreamConstants.END_DOCUMENT: if (contentHandler != null) contentHandler.endDocument(); break; case XMLStreamConstants.DTD: XMLParser.Doctype doctype = parser.doctype; if (lexicalHandler != null) { String rootName = doctype.rootName; String publicId = doctype.publicId; String systemId2 = doctype.systemId; lexicalHandler.startDTD(rootName, publicId, systemId2); } for (Iterator i = doctype.entryIterator(); i.hasNext(); ) { String entry = (String) i.next(); char c = entry.charAt(0); String name = entry.substring(1); if ('E' == c) { // Element decl if (declHandler != null) { String model = doctype.getElementModel(name); declHandler.elementDecl(name, model); } } else if ('A' == c) { // Attlist decl if (declHandler != null) { for (Iterator j = doctype.attlistIterator(name); j.hasNext(); ) { Map.Entry att = (Map.Entry) j.next(); String aname = (String) att.getKey(); XMLParser.AttributeDecl decl = (XMLParser.AttributeDecl) att.getValue(); String type = decl.type; String value = decl.value; String mode = null; switch (decl.valueType) { case XMLParser.ATTRIBUTE_DEFAULT_FIXED: mode = "#FIXED"; break; case XMLParser.ATTRIBUTE_DEFAULT_REQUIRED: mode = "#REQUIRED"; break; case XMLParser.ATTRIBUTE_DEFAULT_IMPLIED: mode = "#IMPLIED"; break; } declHandler.attributeDecl(name, aname, type, mode, value); } } } else if ('e' == c) { // Entity decl Object entity = doctype.getEntity(name); if (entity instanceof String) { if (declHandler != null) declHandler.internalEntityDecl(name, (String) entity); } else { XMLParser.ExternalIds ids = (XMLParser.ExternalIds) entity; if (ids.notationName != null) { if (dtdHandler != null) { String pub = ids.publicId; String url = ids.systemId; String not = ids.notationName; dtdHandler.unparsedEntityDecl(name, pub, url, not); } } else { if (declHandler != null) { String pub = ids.publicId; String url = ids.systemId; declHandler.externalEntityDecl(name, pub, url); } } } } else if ('n' == c) { // Notation decl if (dtdHandler != null) { XMLParser.ExternalIds ids = doctype.getNotation(name); String pub = ids.publicId; String url = ids.systemId; dtdHandler.notationDecl(name, pub, url); } } } if (lexicalHandler != null) lexicalHandler.endDTD(); } } } catch (XMLStreamException e) { if (!startDocumentDone && contentHandler != null) contentHandler.startDocument(); SAXParseException e2 = new SAXParseException(e.getMessage(), this); e2.initCause(e); if (errorHandler != null) errorHandler.fatalError(e2); if (contentHandler != null) contentHandler.endDocument(); throw e2; } finally { if (opened) in.close(); reset(); } }
11,119
public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException { if (parser != null) throw new IllegalStateException("parsing in progress"); String FEATURES = "http://xml.org/sax/features/"; String PROPERTIES = "http://xml.org/sax/properties/"; if ((FEATURES + "namespaces").equals(name)) namespaceAware = Boolean.TRUE.equals(value); else if ((FEATURES + "string-interning").equals(name)) stringInterning = Boolean.TRUE.equals(value); else if ((FEATURES + "validation").equals(name)) validating = Boolean.TRUE.equals(value); else if ((FEATURES + "external-general-entities").equals(name)) externalEntities = Boolean.TRUE.equals(value); else if ((FEATURES + "external-parameter-entities").equals(name)) externalEntities = Boolean.TRUE.equals(value); else if ((PROPERTIES + "declaration-handler").equals(name)) declHandler = (DeclHandler) value; else if ((PROPERTIES + "lexical-handler").equals(name)) lexicalHandler = (LexicalHandler) value; else throw new SAXNotSupportedException(name); }
public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException { if (parser != null) throw new IllegalStateException("parsing in progress"); String FEATURES = "http://xml.org/sax/features/"; String PROPERTIES = "http://xml.org/sax/properties/"; if ((FEATURES + "namespaces").equals(name)) namespaceAware = Boolean.TRUE.equals(value); else if ((FEATURES + "string-interning").equals(name)) stringInterning = Boolean.TRUE.equals(value); else if ((FEATURES + "validation").equals(name)) validating = Boolean.TRUE.equals(value); else if ((FEATURES + "external-general-entities").equals(name)) externalEntities = Boolean.TRUE.equals(value); else if ((FEATURES + "external-parameter-entities").equals(name)) externalEntities = Boolean.TRUE.equals(value); else if ((PROPERTIES + "declaration-handler").equals(name)) declHandler = (DeclHandler) value; else if ((PROPERTIES + "lexical-handler").equals(name)) lexicalHandler = (LexicalHandler) value; else throw new SAXNotSupportedException(name); }
11,121
public JNodePolicy(ExtensionPoint permissionsEp) { this.policyFile = new PolicyFile(ClassLoader .getSystemResource("/org/jnode/security/jnode.policy")); this.codeSource2Permissions = new HashMap<CodeSource, PermissionCollection>(); this.permissionsEp = permissionsEp; loadExtensions(); }
public JNodePolicy(ExtensionPoint permissionsEp) { this.policyFile = new PolicyFile(ClassLoader .getSystemResource("/org/jnode/security/jnode.policy")); this.codeSource2Permissions = new HashMap<CodeSource, PermissionCollection>(); this.permissionsEp = permissionsEp; loadExtensions(); }
11,123