Java Doc for BlockFile.java in  » Database-DBMS » Quadcap-Embeddable-Database » com » quadcap » sql » file » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » Quadcap Embeddable Database » com.quadcap.sql.file 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.quadcap.sql.file.BlockFile

BlockFile
public class BlockFile implements PageManager,SegmentManager(Code)
This class is used to create, modify, or read a blocked file. The blocked file is accessed as a number of fixed size blocks, which are accessed through a cache of a size specified by the class user.
author:
   Stan Bailes


Field Summary
final static  intMAX_PAGESHIFT
    
final static  intMAX_STREAM
    
final static  intMIN_SUBPAGE
    
final static  intREF_SIZE
    
 BlockAccessba
    
 intblockSize
    
 ByteArrayOutputStreambos
    
 BlockCachecache
     The cache of file blocks.
 ObjectfileLock
    
 booleaninMemory
    
 longlastBlock
     Cached copy of largest allocated block number.
 intmaxPageShift
    
 MutableByteArrayInputStreammbis
    
 longmemObjectCount
    
 LongMapmemoryObjects
    
final static  intoBLOCKSIZE
    
final static  intoFREELIST
    
final static  intoHASH_PASSWD_len
    
final static  intoHASH_PASSWD_start
    
final static  intoHEADER_SIZE
    
final static  intoLASTBLOCK
    
final static  intoSTREAM_START
    
final static  intoSUBPAGE_ROOT
    
 ObjectInputStreamois
    
 ObjectOutputStreamoos
    
 PageManager[]pageManagers
    
final static  booleanquick
    
 booleanreadOnly
    
 BlockStorestore
     The underlying store used by the cache to access the file.

Constructor Summary
public  BlockFile(String filename, String mode, Properties props, int blocksize, int cacheSize)
     Create a new BlockFile, attached to the specified file.

Method Summary
public  voidclearModified()
    
public  voidclose()
     Flush the cache and close the underlying file.
public  voiddump()
    
final  voidensureLastBlock(long i)
    
final public  voidflush(boolean fastSync)
    
public  voidfreePage(long ref)
     Add this block to the free list.
public  voidfreeSegment(long seg)
    
public  voidfreeStream(long page)
     Destroy the stream with the specified root page and free up the storage it was using.
public  BlockgetBlock(long i)
    
public  intgetBlockSize()
    
public  byte[]getBytes(long seg)
    
public  RandomAccessInputStreamgetInputStream(long block)
     Return a new input stream, reading from the region with the specified root block.
public  ObjectgetLock()
    
 LoggetLog()
    
public  StringgetName()
    
public  ObjectgetObject(long ref)
    
public  RandomAccessOutputStreamgetOutputStream(long block)
     Return a new output stream, writing to the region with the specified root block.
public  PagegetPage(long i)
     Locate the specified block and return the cache entry associated with that block.
static  longgetPageBlock(long ref)
    
public  PageManagergetPageManager(int i)
    
public  PageManagergetPageManagerForLen(long len)
    
public  PageManagergetPageManagerForPage(long page)
    
static  intgetPageOffset(PageManager pm, long ref)
    
final public  intgetPageSize()
     Return the block size used in this file.
public  longgetSize()
    
public  RandomAccessgetStream(long blockRef)
    
public  longgetUserBlock(int stream)
    
public static  voidmain(String[] args)
    
protected  BlockStoremakeStore(Properties props, String filename, int blockSize, String mode)
    
public  longnewPage()
     Return the head of the free list, or grow the tail of the file.
public  longputBytes(byte[] buf)
    
public  longputObject(Object obj)
    
public  voidremoveObject(long ref)
    
public  voidrestoreBlock(long b, byte[] buf, int off)
    
public  voidrevert()
    
public  voidsetLog(Log log)
    
public  voidshowCache(PrintWriter os)
    
public  Stringsignature()
    
public  StringtoString()
    
public  voidupdateBytes(long seg, byte[] buf)
     Update a segment with new value bytes.
public  voidupdateObject(long seg, Object obj)
     Write a new version of a persistent object to the store.

Field Detail
MAX_PAGESHIFT
final static int MAX_PAGESHIFT(Code)



MAX_STREAM
final static int MAX_STREAM(Code)



MIN_SUBPAGE
final static int MIN_SUBPAGE(Code)



REF_SIZE
final static int REF_SIZE(Code)



ba
BlockAccess ba(Code)



blockSize
int blockSize(Code)



bos
ByteArrayOutputStream bos(Code)



cache
BlockCache cache(Code)
The cache of file blocks.



fileLock
Object fileLock(Code)



inMemory
boolean inMemory(Code)



lastBlock
long lastBlock(Code)
Cached copy of largest allocated block number.



maxPageShift
int maxPageShift(Code)



mbis
MutableByteArrayInputStream mbis(Code)



memObjectCount
long memObjectCount(Code)



memoryObjects
LongMap memoryObjects(Code)
For main-memory mode, our objects



oBLOCKSIZE
final static int oBLOCKSIZE(Code)



oFREELIST
final static int oFREELIST(Code)



oHASH_PASSWD_len
final static int oHASH_PASSWD_len(Code)



oHASH_PASSWD_start
final static int oHASH_PASSWD_start(Code)



oHEADER_SIZE
final static int oHEADER_SIZE(Code)



oLASTBLOCK
final static int oLASTBLOCK(Code)



oSTREAM_START
final static int oSTREAM_START(Code)



oSUBPAGE_ROOT
final static int oSUBPAGE_ROOT(Code)



ois
ObjectInputStream ois(Code)



oos
ObjectOutputStream oos(Code)



pageManagers
PageManager[] pageManagers(Code)



quick
final static boolean quick(Code)



readOnly
boolean readOnly(Code)



store
BlockStore store(Code)
The underlying store used by the cache to access the file.




Constructor Detail
BlockFile
public BlockFile(String filename, String mode, Properties props, int blocksize, int cacheSize) throws IOException(Code)
Create a new BlockFile, attached to the specified file. For an existing BlockFile, use the blocksize with which the file was created -- for a new file, use the specified blocksize.
Parameters:
  filename - the file to operate on.
Parameters:
  blockSize - the block size to use if we're creating a new file.
Parameters:
  mode - "r" (read only) or "rw" (read-write) access.




Method Detail
clearModified
public void clearModified() throws IOException(Code)



close
public void close() throws IOException(Code)
Flush the cache and close the underlying file.



dump
public void dump() throws IOException(Code)



ensureLastBlock
final void ensureLastBlock(long i) throws IOException(Code)



flush
final public void flush(boolean fastSync) throws IOException(Code)



freePage
public void freePage(long ref) throws IOException(Code)
Add this block to the free list.
Parameters:
  ref - the number of the now free block.



freeSegment
public void freeSegment(long seg) throws IOException(Code)



freeStream
public void freeStream(long page) throws IOException(Code)
Destroy the stream with the specified root page and free up the storage it was using.
Parameters:
  page - the root page of the region
exception:
  IOException - if the page number isn't valid, or if anothererror is detected trying to access the region.



getBlock
public Block getBlock(long i) throws IOException(Code)



getBlockSize
public int getBlockSize()(Code)



getBytes
public byte[] getBytes(long seg) throws IOException(Code)
Return the segment as a byte array
Parameters:
  seg - the segment id the value of the segment's bytes



getInputStream
public RandomAccessInputStream getInputStream(long block) throws IOException(Code)
Return a new input stream, reading from the region with the specified root block.
Parameters:
  block - the root block of the region an InputStream bound to the region.
exception:
  IOException - if the block number isn't valid, or if anothererror is detected trying to access the region.



getLock
public Object getLock()(Code)



getLog
Log getLog()(Code)



getName
public String getName()(Code)



getObject
public Object getObject(long ref) throws IOException(Code)
Return the specified persistent object from the store
Parameters:
  ref - the block number of the object's root the object
exception:
  IOException - may be thrown



getOutputStream
public RandomAccessOutputStream getOutputStream(long block) throws IOException(Code)
Return a new output stream, writing to the region with the specified root block.
Parameters:
  block - the root block of the region an OutputStream bound to the region.
exception:
  IOException - if the block number isn't valid, or if anothererror is detected trying to access the region.



getPage
public Page getPage(long i) throws IOException(Code)
Locate the specified block and return the cache entry associated with that block. It needs to be the case that the cache entry is "locked" while this returned object is active, so maybe the Block class needs a finalize() routine.
Parameters:
  i - the block number the cache-handle of the block.



getPageBlock
static long getPageBlock(long ref)(Code)



getPageManager
public PageManager getPageManager(int i) throws IOException(Code)
Return the specified sub-page manager



getPageManagerForLen
public PageManager getPageManagerForLen(long len) throws IOException(Code)



getPageManagerForPage
public PageManager getPageManagerForPage(long page) throws IOException(Code)



getPageOffset
static int getPageOffset(PageManager pm, long ref)(Code)



getPageSize
final public int getPageSize()(Code)
Return the block size used in this file.



getSize
public long getSize()(Code)



getStream
public RandomAccess getStream(long blockRef) throws IOException(Code)
Return a RandomAccess object which references the specified block



getUserBlock
public long getUserBlock(int stream) throws IOException(Code)



main
public static void main(String[] args)(Code)



makeStore
protected BlockStore makeStore(Properties props, String filename, int blockSize, String mode) throws IOException(Code)



newPage
public long newPage() throws IOException(Code)
Return the head of the free list, or grow the tail of the file. the number of an available block.



putBytes
public long putBytes(byte[] buf) throws IOException(Code)
Create a new segment with the specified bytes value and return its reference
Parameters:
  buf - the value to write to the new segment the segment id



putObject
public long putObject(Object obj) throws IOException(Code)
Write a new object to the store and return its reference
Parameters:
  obj - the object the block number of the object's root
exception:
  IOException - may be thrown



removeObject
public void removeObject(long ref) throws IOException(Code)
Remove an object from the store
Parameters:
  ref - the block number of the object's root
exception:
  IOException - may be thrown



restoreBlock
public void restoreBlock(long b, byte[] buf, int off) throws IOException(Code)



revert
public void revert() throws IOException(Code)



setLog
public void setLog(Log log)(Code)



showCache
public void showCache(PrintWriter os)(Code)



signature
public String signature() throws IOException(Code)



toString
public String toString()(Code)



updateBytes
public void updateBytes(long seg, byte[] buf) throws IOException(Code)
Update a segment with new value bytes.
Parameters:
  buf - the value to write to the segment
Parameters:
  seg - the segment id



updateObject
public void updateObject(long seg, Object obj) throws IOException(Code)
Write a new version of a persistent object to the store.
Parameters:
  blockNum - the address of the object's root page in the store
Parameters:
  obj - the new object value
exception:
  IOException - may be thrown



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.