Source Code Cross Referenced for plasmaStore.java in  » Search-Engine » yacy » de » anomic » plasma » 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 » Search Engine » yacy » de.anomic.plasma 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // plasmaStore.java 
002:        // -----------------------
003:        // part of YACY
004:        // (C) by Michael Peter Christen; mc@anomic.de
005:        // first published on http://www.anomic.de
006:        // Frankfurt, Germany, 2004
007:        // last major change: 20.01.2004
008:        //
009:        // You agree that the Author(s) is (are) not responsible for cost,
010:        // loss of data or any harm that may be caused by usage of this softare or
011:        // this documentation. The usage of this software is on your own risk. The
012:        // installation and usage (starting/running) of this software may allow other
013:        // people or application to access your computer and any attached devices and
014:        // is highly dependent on the configuration of the software which must be
015:        // done by the user of the software;the author(s) is (are) also
016:        // not responsible for proper configuration and usage of the software, even
017:        // if provoked by documentation provided together with the software.
018:        //
019:        // THE SOFTWARE THAT FOLLOWS AS ART OF PROGRAMMING BELOW THIS SECTION
020:        // IS PUBLISHED UNDER THE GPL AS DOCUMENTED IN THE FILE gpl.txt ASIDE THIS
021:        // FILE AND AS IN http://www.gnu.org/licenses/gpl.txt
022:        // ANY CHANGES TO THIS FILE ACCORDING TO THE GPL CAN BE DONE TO THE
023:        // LINES THAT FOLLOWS THIS COPYRIGHT NOTICE HERE, BUT CHANGES MUST NOT
024:        // BE DONE ABOVE OR INSIDE THE COPYRIGHT NOTICE. A RE-DISTRIBUTION
025:        // MUST CONTAIN THE INTACT AND UNCHANGED COPYRIGHT NOTICE.
026:        // CONTRIBUTIONS AND CHANGES TO THE PROGRAM CODE SHOULD BE MARKED AS SUCH.
027:
028:        /*
029:         This class provides storage functions for the plasma search engine.
030:         Unlike the plasmaSwitchboard, which holds run-time information,
031:         this class holds general index information that is in run-time
032:         specific.
033:         */
034:
035:        package de.anomic.plasma;
036:
037:        import java.io.File;
038:        import java.io.FileInputStream;
039:        import java.io.FileOutputStream;
040:        import java.io.IOException;
041:
042:        //import java.io.RandomAccessFile;
043:
044:        public class plasmaStore {
045:
046:            // some static helper methods
047:            public static void saveGzip(File f, byte[] content)
048:                    throws IOException {
049:                java.util.zip.GZIPOutputStream gzipout = null;
050:                try {
051:                    f.getParentFile().mkdirs();
052:                    gzipout = new java.util.zip.GZIPOutputStream(
053:                            new FileOutputStream(f));
054:                    gzipout.write(content, 0, content.length);
055:                } finally {
056:                    if (gzipout != null)
057:                        try {
058:                            gzipout.close();
059:                        } catch (Exception e) {
060:                        }
061:                }
062:            }
063:
064:            public static byte[] loadGzip(File f) throws IOException {
065:                java.util.zip.GZIPInputStream gzipin = null;
066:                try {
067:                    gzipin = new java.util.zip.GZIPInputStream(
068:                            new FileInputStream(f));
069:                    byte[] result = new byte[1024];
070:                    byte[] buffer = new byte[512];
071:                    byte[] b;
072:                    int len = 0;
073:                    int last;
074:                    while ((last = gzipin.read(buffer, 0, buffer.length)) > 0) {
075:                        // assert the buffer to the result
076:                        while (result.length - len < last) {
077:                            // the result array is too small, increase space
078:                            b = new byte[result.length * 2];
079:                            System.arraycopy(result, 0, b, 0, len);
080:                            result = b;
081:                            b = null;
082:                        }
083:                        // copy the last read
084:                        System.arraycopy(buffer, 0, result, len, last);
085:                        len += last;
086:                    }
087:                    gzipin.close();
088:                    // finished with reading. now cut the result to the right size
089:                    b = new byte[len];
090:                    System.arraycopy(result, 0, b, 0, len);
091:                    result = null;
092:                    return b;
093:                } finally {
094:                    if (gzipin != null)
095:                        try {
096:                            gzipin.close();
097:                        } catch (Exception e) {
098:                        }
099:                }
100:            }
101:
102:            /*    public static void saveProperties(File f, Properties props, String comment) throws IOException {
103:            File fp = f.getParentFile();
104:            if (fp != null) fp.mkdirs();
105:            FileOutputStream fos = new FileOutputStream(f);
106:            props.store(fos, comment);
107:            fos.close();
108:            }
109:
110:            public static Properties loadProperties(File f) throws IOException {
111:            Properties p = new Properties();
112:            FileInputStream fis = new FileInputStream(f);
113:            p.load(fis);
114:            fis.close();
115:            return p;
116:            }
117:             */
118:
119:            /*
120:            private static long[] appendFileToStack(File fragment, File dest) throws IOException {
121:            	// returns a long[2] with
122:            	// long[0] = startOfFileFragemt in dest
123:            	// long[1] = lengthOfFileFragment in dest
124:            	long l = fragment.length();
125:            	long p = dest.length();
126:            	RandomAccessFile fo = new RandomAccessFile(dest, "rw");
127:            	FileInputStream fi = new FileInputStream(fragment);
128:            	byte[] buffer = new byte[1024];
129:            	int c;
130:            	fo.seek(p);
131:            	while ((c = fi.read(buffer)) >= 0)
132:            		fo.write(buffer, 0, c);
133:            	fi.close();
134:            	fo.close();
135:            	long[] r = new long[2];
136:            	r[0] = p;
137:            	r[1] = l;
138:            	return r;
139:            }
140:             */
141:
142:            /*
143:            public static void main(String[] args) {
144:            try {
145:                HashSet set = new HashSet();
146:                for (int i = 0; i < args.length; i++) set.add(args[i]);
147:                plasmaStore store = new plasmaStore(new File("DATABASE"));
148:                List result = plasmaSearch.search(set);
149:                for (int i = 0; i < result.size(); i++) {
150:            	((plasmaLURL.entry) result.get(i)).print();
151:                }
152:            } catch (Exception e) {
153:                e.printStackTrace();
154:            }
155:            }
156:             */
157:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.