Examples of FileException


Examples of com.hp.hpl.jena.tdb.base.file.FileException

    @Override
    public void reposition(long posn)
    {
        if ( inAllocWrite )
            throw new FileException("In the middle of an alloc-write") ;
        if ( posn < 0 || posn > length() )
            throw new IllegalArgumentException("reposition: Bad location: "+posn) ;
        flushOutputBuffer() ;
        file.truncate(posn) ;
        filesize = posn ;
View Full Code Here

Examples of com.hp.hpl.jena.tdb.base.file.FileException

    {
        if ( logging )
            log("R(0x%X)", loc) ;
       
        if ( inAllocWrite )
            throw new FileException("In the middle of an alloc-write") ;
        if ( loc < 0 )
            throw new IllegalArgumentException("ObjectFile.read["+file.getLabel()+"]: Bad read: "+loc) ;
       
        // Maybe it's in the in the write buffer.
        // Maybe the write buffer should keep more structure?
        if ( loc >= filesize )
        {
            if ( loc >= filesize+writeBuffer.position() )
                throw new IllegalArgumentException("ObjectFileStorage.read["+file.getLabel()+"]: Bad read: location="+loc+" >= max="+(filesize+writeBuffer.position())) ;
           
            int x = writeBuffer.position() ;
            int y = writeBuffer.limit() ;
           
            int offset = (int)(loc-filesize) ;
            int len = writeBuffer.getInt(offset) ;
            int posn = offset + SizeOfInt ;
            // Slice the data bytes,
            writeBuffer.position(posn) ;
            writeBuffer.limit(posn+len) ;
            ByteBuffer bb = writeBuffer.slice() ;
            writeBuffer.limit(y) ;
            writeBuffer.position(x) ;
            return bb ;
        }
       
        // No - it's in the underlying file storage.
        lengthBuffer.clear() ;
        int x = file.read(lengthBuffer, loc) ;
        if ( x != 4 )
            throw new FileException("ObjectFileStorage.read["+file.getLabel()+"]("+loc+")[filesize="+filesize+"][file.size()="+file.size()+"]: Failed to read the length : got "+x+" bytes") ;
        int len = lengthBuffer.getInt(0) ;
        // Sanity check.
        if ( len > filesize-(loc+SizeOfInt) )
        {
            String msg = "ObjectFileStorage.read["+file.getLabel()+"]("+loc+")[filesize="+filesize+"][file.size()="+file.size()+"]: Impossibly large object : "+len+" bytes > filesize-(loc+SizeOfInt)="+(filesize-(loc+SizeOfInt)) ;
            SystemTDB.errlog.error(msg) ;
            throw new FileException(msg) ;
        }
       
        ByteBuffer bb = ByteBuffer.allocate(len) ;
        if ( len == 0 )
            // Zero bytes.
            return bb ;
        x = file.read(bb, loc+SizeOfInt) ;
        bb.flip() ;
        if ( x != len )
            throw new FileException("ObjectFileStorage.read: Failed to read the object ("+len+" bytes) : got "+x+" bytes") ;
        return bb ;
    }
View Full Code Here

Examples of com.hp.hpl.jena.tdb.base.file.FileException

            String s = StrUtils.fromUTF8bytes(p.getRight().array()) ;
           
            long x = base.write(p.getRight()) ;
           
            if ( p.getLeft()+otherAllocOffset != x )
                throw new FileException("Expected id of "+(p.getLeft()+otherAllocOffset)+", got an id of "+x) ;
        }
    }
View Full Code Here

Examples of com.robustaweb.library.commons.exception.FileException

     */
    public static void createDirectory(String rootPath, String directoryName) throws FileException {
        File f = new File(rootPath + "/" + directoryName);
        boolean result;
        if (f.exists()) {
            throw new FileException("Directory already exists");
        } else {
            result = f.mkdir();
            if (!result) {
                throw new FileException("Directory could not be created for unknown reason");
            }
        }
    }
View Full Code Here

Examples of com.robustaweb.library.commons.exception.FileException

                } else {
                    ///      System.out.println("FILE TO DELETE : " + files[i].getPath() + " - " + files[i].delete());
                }
            }
        } else {
            throw new FileException("The path :'" + path + "' does't exist ");
        }

        if (!path.delete()) {
            throw new FileException("Could not delete path " + path + "!");

        } else {
            //nothing to do, it's ok
        }
View Full Code Here

Examples of com.robustaweb.library.commons.exception.FileException

     */
    static public boolean deleteFile(String path) throws FileException {

        File f = new File(path);
        if (f == null || !f.exists()) {
            throw new FileException("Can't find the file at path : " + path);
        } else {
            return f.delete();
        }

    }
View Full Code Here

Examples of fr.norsys.mapper.console.exception.FileException

    try {
      validateDirectory(directoryPath);
      File file = new File(directoryPath + name);
      file.createNewFile();
    } catch (IOException e) {
      throw new FileException("Impossible to create file " + directoryPath + name + ": "+e);
    }
  }
View Full Code Here

Examples of fr.norsys.mapper.console.exception.FileException

  public void deleteFile(String name, String directoryPath) throws FileException {
    validateDirectory(directoryPath);
    File file = new File(directoryPath+name);
    if(!file.exists() || !file.delete())
      throw new FileException("Impossible to delete file " + directoryPath + name);
  }
View Full Code Here

Examples of fr.norsys.mapper.console.exception.FileException

      throws FileException {
    validateDirectory(directoryPath);
    File f = new File(directoryPath+previousName);
    File f2 = new File(directoryPath+newName);
    if(!f.renameTo(f2))
      throw new FileException(f.getName()+ " can't be renamed");
  }
View Full Code Here

Examples of org.apache.directory.mavibot.btree.exception.FileException

        {
            fileChannel.write( RECORD_MANAGER_HEADER_BUFFER, 0 );
        }
        catch ( IOException ioe )
        {
            throw new FileException( ioe.getMessage() );
        }

        RECORD_MANAGER_HEADER_BUFFER.clear();

        // Reset the old versions
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.