com.ximpleware.extended
Class XMLMemMappedBuffer

java.lang.Object
  extended by com.ximpleware.extended.XMLMemMappedBuffer
All Implemented Interfaces:
IByteBuffer

public class XMLMemMappedBuffer
extends Object
implements IByteBuffer

XMLMemMappedBuffer maps an XML document into memory using memory map. It avoids the complete loading of the document in memory thus making it possible to process very large files. But the trade off is potentially lower performance due to disk IO.


Constructor Summary
XMLMemMappedBuffer()
           
 
Method Summary
 byte byteAt(long index)
          Get the byte at the given index of the underlying byte storage.
 byte[] getBytes()
          NOt implemented yet
 byte[] getBytes(int offset, int len)
          not implemented yet
 long length()
          Total size in terms of # of bytes.
 void readFile(String fileName)
           
 void writeToFileOutputStream(FileOutputStream ost, long os, long len)
          write the segment (denoted by its offset and length) into an output file stream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLMemMappedBuffer

public XMLMemMappedBuffer()
Method Detail

length

public long length()
Description copied from interface: IByteBuffer
Total size in terms of # of bytes.

Specified by:
length in interface IByteBuffer
Returns:
long

byteAt

public byte byteAt(long index)
Description copied from interface: IByteBuffer
Get the byte at the given index of the underlying byte storage.

Specified by:
byteAt in interface IByteBuffer
Returns:
byte

readFile

public void readFile(String fileName)
              throws IOException,
                     ParseExceptionHuge
Throws:
IOException
ParseExceptionHuge

getBytes

public byte[] getBytes()
NOt implemented yet

Specified by:
getBytes in interface IByteBuffer

getBytes

public byte[] getBytes(int offset,
                       int len)
not implemented yet

Specified by:
getBytes in interface IByteBuffer
Parameters:
offset - int bytes offset (not UTF char unit)
len - int
Returns:
byte[]

writeToFileOutputStream

public void writeToFileOutputStream(FileOutputStream ost,
                                    long os,
                                    long len)
                             throws IOException
write the segment (denoted by its offset and length) into an output file stream

Specified by:
writeToFileOutputStream in interface IByteBuffer
Throws:
IOException


Copyright © 2013. All Rights Reserved.