Package krati.core.segment

Examples of krati.core.segment.Segment


           
            // no data found
            if(segPos < Segment.dataStartPosition) return -1;
           
            // get data segment
            Segment seg = _segmentManager.getSegment(segInd);
            if(seg == null) return -1;
           
            // read data length
            int size = _addressFormat.getDataSize(address);
            return (size == 0) ? seg.readInt(segPos) : size;
        } catch(Exception e) {
            _log.warn(e.getMessage());
            return -1;
        }
    }
View Full Code Here


           
            // no data found
            if(segPos < Segment.dataStartPosition) return null;
           
            // get data segment
            Segment seg = _segmentManager.getSegment(segInd);
            if(seg == null) return null;
           
            // read data length
            int size = _addressFormat.getDataSize(address);
            int len = (size == 0) ? seg.readInt(segPos) : size;
           
            // read data into byte array
            byte[] data = new byte[len];
            if (len > 0) {
                seg.read(segPos + 4, data);
            }
           
            return data;
        } catch(Exception e) {
            _log.warn(e.getMessage());
View Full Code Here

           
            // no data found
            if(segPos < Segment.dataStartPosition) return -1;
           
            // get data segment
            Segment seg = _segmentManager.getSegment(segInd);
            if(seg == null) return -1;
           
            // read data length
            int size = _addressFormat.getDataSize(address);
            int len = (size == 0) ? seg.readInt(segPos) : size;
           
            // read data into byte array
            if (len > 0) {
                seg.read(segPos + 4, data, offset, len);
            }
           
            return len;
        } catch(Exception e) {
            _log.warn(e.getMessage());
View Full Code Here

           
            // no data found
            if(segPos < Segment.dataStartPosition) return -1;
           
            // get data segment
            Segment seg = _segmentManager.getSegment(segInd);
            if(seg == null) return -1;
           
            // read data length
            int size = _addressFormat.getDataSize(address);
            int len = (size == 0) ? seg.readInt(segPos) : size;
           
            // read data into byte array
            if (len > 0) {
                len = Math.min(len, dst.length);
                seg.read(segPos + 4, dst, 0, len);
            }
           
            return len;
        } catch(Exception e) {
            _log.warn(e.getMessage());
View Full Code Here

           
            // no data found
            if(segPos < Segment.dataStartPosition) return -1;
           
            // get data segment
            Segment seg = _segmentManager.getSegment(segInd);
            if(seg == null) return -1;
           
            // read data length
            int size = _addressFormat.getDataSize(address);
            int len = (size == 0) ? seg.readInt(segPos) : size;
           
            // read data into byte array
            if (len > 0) {
                if (len > offset) {
                    len = Math.min(len - offset, dst.length);
                    seg.read(segPos + 4 + offset, dst, 0, len);
                } else {
                    return -1;
                }
            }
           
View Full Code Here

           
            // no data found
            if(segPos < Segment.dataStartPosition) return -1;
           
            // get data segment
            Segment seg = _segmentManager.getSegment(segInd);
            if(seg == null) return -1;
           
            // read data length
            int size = _addressFormat.getDataSize(address);
            int len = (size == 0) ? seg.readInt(segPos) : size;
           
            // transfer data to a writable channel
            if (len > 0) {
                seg.transferTo(segPos + 4, len, channel);
            }
           
            return len;
        } catch(Exception e) {
            return -1;
View Full Code Here

               
                // submit current segment index buffer
                submitSegmentIndexBuffer();
               
                // update next segment and segment index buffer
                Segment nextSegment = _compactor.peekTargetSegment();
                if(nextSegment != null) {
                    persist();
                   
                    _segment = nextSegment;
                    _compactor.pollTargetSegment();
View Full Code Here

TOP

Related Classes of krati.core.segment.Segment

Copyright © 2018 www.massapicom. 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.