Examples of FileException


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

        lengthBuffer.flip() ;
        long location = file.position() ;
        file.write(lengthBuffer) ;
        int x = file.write(bb) ;
        if ( x != len )
            throw new FileException() ;
        filesize = filesize+x+SizeOfInt ;
       
        if ( logging )
        {
            log("Posn: %d", file.position());
View Full Code Here

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

    public void completeWrite(Block block)
    {
        if ( logging )
            log("CW: %s @0x%X",block, allocLocation) ;
        if ( ! inAllocWrite )
            throw new FileException("Not in the process of an allocated write operation pair") ;
        if ( allocBlock != null && ( allocBlock.getByteBuffer() != block.getByteBuffer() ) )
            throw new FileException("Wrong byte buffer in an allocated write operation pair") ;

        inAllocWrite = false ;
       
        ByteBuffer buffer = block.getByteBuffer() ;
       
View Full Code Here

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

    public void abortWrite(Block block)
    {
        allocBlock = null ;
        int oldstart = (int)(allocLocation-filesize) ;
        if ( oldstart != oldBufferPosn)
            throw new FileException("Wrong reset point: calc="+oldstart+" : expected="+oldBufferPosn) ;       
       
        writeBuffer.position(oldstart) ;
        writeBuffer.limit(oldBufferLimit) ;
        allocLocation = -1 ;
        oldBufferPosn = -1 ;
View Full Code Here

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.hp.hpl.jena.tdb.base.file.FileException

        lengthBuffer.flip() ;
        long location = file.position() ;
        file.write(lengthBuffer) ;
        int x = file.write(bb) ;
        if ( x != len )
            throw new FileException() ;
        filesize = filesize+x+SizeOfInt ;
       
        if ( logging )
        {
            log("Posn: %d", file.position());
View Full Code Here

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

    public void completeWrite(Block block)
    {
        if ( logging )
            log("CW: %s @0x%X",block, allocLocation) ;
        if ( ! inAllocWrite )
            throw new FileException("Not in the process of an allocated write operation pair") ;
        if ( allocBlock != null && ( allocBlock.getByteBuffer() != block.getByteBuffer() ) )
            throw new FileException("Wrong byte buffer in an allocated write operation pair") ;

        inAllocWrite = false ;
       
        ByteBuffer buffer = block.getByteBuffer() ;
       
View Full Code Here

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

    public void abortWrite(Block block)
    {
        allocBlock = null ;
        int oldstart = (int)(allocLocation-filesize) ;
        if ( oldstart != oldBufferPosn)
            throw new FileException("Wrong reset point: calc="+oldstart+" : expected="+oldBufferPosn) ;       
       
        writeBuffer.position(oldstart) ;
        writeBuffer.limit(oldBufferLimit) ;
        allocLocation = -1 ;
        oldBufferPosn = -1 ;
View Full Code Here

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
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.