Java Doc for WriterPoolMember.java in  » Web-Crawler » heritrix » org » archive » io » 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 » Web Crawler » heritrix » org.archive.io 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.archive.io.WriterPoolMember

All known Subclasses:   org.archive.io.arc.ARCWriter,  org.archive.io.warc.v10.ExperimentalWARCWriter,  org.archive.io.warc.ExperimentalWARCWriter,
WriterPoolMember
abstract public class WriterPoolMember implements ArchiveFileConstants(Code)
Member of WriterPool . Implements rotating off files, file naming with some guarantee of uniqueness, and position in file. Subclass to pick up functionality for a particular Writer type.
author:
   stack
version:
   $Date: 2007-04-02 22:02:14 +0000 (Mon, 02 Apr 2007) $ $Revision: 5032 $


Field Summary
final public static  StringDEFAULT_PREFIX
     Default file prefix.
final public static  StringDEFAULT_SUFFIX
     Default for file suffix.
final public static  StringHOSTNAME_VARIABLE
     Value to interpolate with actual hostname.
final public static  StringUTF8
    

Constructor Summary
protected  WriterPoolMember(AtomicInteger serialNo, OutputStream out, File file, boolean cmprs, String a14DigitDate)
     Constructor. Takes a stream.
public  WriterPoolMember(AtomicInteger serialNo, List<File> dirs, String prefix, boolean cmprs, long maxSize, String extension)
     Constructor.
Parameters:
  serialNo - used to create unique filename sequences
Parameters:
  dirs - Where to drop files.
Parameters:
  prefix - File prefix to use.
Parameters:
  cmprs - Compress the records written.
public  WriterPoolMember(AtomicInteger serialNo, List<File> dirs, String prefix, String suffix, boolean cmprs, long maxSize, String extension)
     Constructor.
Parameters:
  serialNo - used to create unique filename sequences
Parameters:
  dirs - Where to drop files.
Parameters:
  prefix - File prefix to use.
Parameters:
  cmprs - Compress the records written.

Method Summary
public  voidcheckSize()
     Call this method just before/after any significant write. Call at the end of the writing of a record or just before we start writing a new record.
protected  FilecheckWriteable(File d)
    
public  voidclose()
    
protected  StringcreateFile()
     Create a new file. Rotates off the current Writer and creates a new in its place to take subsequent writes.
protected  StringcreateFile(File file)
    
protected  voidflush()
    
protected  StringgetBaseFilename()
    
protected  StringgetCreateTimestamp()
    
public  FilegetFile()
     Get this file.
protected  FilegetNextDirectory(List<File> dirs)
    
Parameters:
  dirs - List of File objects that point at directories.
protected  OutputStreamgetOutputStream()
    
public  longgetPosition()
     Postion in current physical file. Used making accounting of bytes written. Position in underlying file.
protected synchronized  TimestampSerialnogetTimestampSerialNo()
    
protected synchronized  TimestampSerialnogetTimestampSerialNo(String timestamp)
     Do static synchronization around getting of counter and timestamp so no chance of a thread getting in between the getting of timestamp and allocation of serial number throwing the two out of alignment.
Parameters:
  timestamp - If non-null, use passed timestamp (must be 14 digitARC format), else if null, timestamp with now.
public  booleanisCompressed()
    
protected  voidpostWriteRecordTasks()
     Post file write tasks.
protected  voidpreWriteRecordTasks()
     Post write tasks. Has side effects.
protected  voidreadFullyFrom(InputStream is, long recordLength, byte[] b)
    
protected  voidreadToLimitFrom(InputStream is, long limit, byte[] b)
    
protected  voidwrite(byte[] b)
    
protected  voidwrite(byte[] b, int off, int len)
    
protected  voidwrite(int b)
    

Field Detail
DEFAULT_PREFIX
final public static String DEFAULT_PREFIX(Code)
Default file prefix. Stands for Internet Archive Heritrix.



DEFAULT_SUFFIX
final public static String DEFAULT_SUFFIX(Code)
Default for file suffix.



HOSTNAME_VARIABLE
final public static String HOSTNAME_VARIABLE(Code)
Value to interpolate with actual hostname.



UTF8
final public static String UTF8(Code)




Constructor Detail
WriterPoolMember
protected WriterPoolMember(AtomicInteger serialNo, OutputStream out, File file, boolean cmprs, String a14DigitDate) throws IOException(Code)
Constructor. Takes a stream. Use with caution. There is no upperbound check on size. Will just keep writing.
Parameters:
  serialNo - used to create unique filename sequences
Parameters:
  out - Where to write.
Parameters:
  file - File the out is connected to.
Parameters:
  cmprs - Compress the content written.
Parameters:
  a14DigitDate - If null, we'll write current time.
throws:
  IOException -



WriterPoolMember
public WriterPoolMember(AtomicInteger serialNo, List<File> dirs, String prefix, boolean cmprs, long maxSize, String extension)(Code)
Constructor.
Parameters:
  serialNo - used to create unique filename sequences
Parameters:
  dirs - Where to drop files.
Parameters:
  prefix - File prefix to use.
Parameters:
  cmprs - Compress the records written.
Parameters:
  maxSize - Maximum size for ARC files written.
Parameters:
  extension - Extension to give file.



WriterPoolMember
public WriterPoolMember(AtomicInteger serialNo, List<File> dirs, String prefix, String suffix, boolean cmprs, long maxSize, String extension)(Code)
Constructor.
Parameters:
  serialNo - used to create unique filename sequences
Parameters:
  dirs - Where to drop files.
Parameters:
  prefix - File prefix to use.
Parameters:
  cmprs - Compress the records written.
Parameters:
  maxSize - Maximum size for ARC files written.
Parameters:
  suffix - File tail to use. If null, unused.
Parameters:
  extension - Extension to give file.




Method Detail
checkSize
public void checkSize() throws IOException(Code)
Call this method just before/after any significant write. Call at the end of the writing of a record or just before we start writing a new record. Will close current file and open a new file if file size has passed out maxSize.

Creates and opens a file if none already open. One use of this method then is after construction, call this method to add the metadata, then call WriterPoolMember.getPosition() to find offset of first record.
exception:
  IOException -




checkWriteable
protected File checkWriteable(File d)(Code)



close
public void close() throws IOException(Code)



createFile
protected String createFile() throws IOException(Code)
Create a new file. Rotates off the current Writer and creates a new in its place to take subsequent writes. Usually called from WriterPoolMember.checkSize() . Name of file created.
throws:
  IOException -



createFile
protected String createFile(File file) throws IOException(Code)



flush
protected void flush() throws IOException(Code)



getBaseFilename
protected String getBaseFilename()(Code)
Get the file name the filename, as if uncompressed



getCreateTimestamp
protected String getCreateTimestamp()(Code)



getFile
public File getFile()(Code)
Get this file. Used by junit test to test for creation and when WriterPool wants to invalidate a file. The current file.



getNextDirectory
protected File getNextDirectory(List<File> dirs) throws IOException(Code)

Parameters:
  dirs - List of File objects that point at directories. Find next directory to write an arc too. If morethan one, it tries to round-robin through each in turn.
throws:
  IOException -



getOutputStream
protected OutputStream getOutputStream()(Code)



getPosition
public long getPosition() throws IOException(Code)
Postion in current physical file. Used making accounting of bytes written. Position in underlying file. Call before or after writingrecords *only* to be safe.
throws:
  IOException -



getTimestampSerialNo
protected synchronized TimestampSerialno getTimestampSerialNo()(Code)



getTimestampSerialNo
protected synchronized TimestampSerialno getTimestampSerialNo(String timestamp)(Code)
Do static synchronization around getting of counter and timestamp so no chance of a thread getting in between the getting of timestamp and allocation of serial number throwing the two out of alignment.
Parameters:
  timestamp - If non-null, use passed timestamp (must be 14 digitARC format), else if null, timestamp with now. Instance of data structure that has timestamp and serial no.



isCompressed
public boolean isCompressed()(Code)



postWriteRecordTasks
protected void postWriteRecordTasks() throws IOException(Code)
Post file write tasks. If compressed, finishes up compression and flushes stream so any subsequent checks get good reading.
exception:
  IOException -



preWriteRecordTasks
protected void preWriteRecordTasks() throws IOException(Code)
Post write tasks. Has side effects. Will open new file if we're at the upperbound. If we're writing compressed files, it will wrap output stream with a GZIP writer with side effect that GZIP header is written out on the stream.
exception:
  IOException -



readFullyFrom
protected void readFullyFrom(InputStream is, long recordLength, byte[] b) throws IOException(Code)



readToLimitFrom
protected void readToLimitFrom(InputStream is, long limit, byte[] b) throws IOException(Code)



write
protected void write(byte[] b) throws IOException(Code)



write
protected void write(byte[] b, int off, int len) throws IOException(Code)



write
protected void write(int b) throws IOException(Code)



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.