Java Doc for GzippedInputStream.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.util.zip.GZIPInputStream
   org.archive.io.GzippedInputStream

GzippedInputStream
public class GzippedInputStream extends GZIPInputStream implements RepositionableStream(Code)
Subclass of GZIPInputStream that can handle a stream made of multiple concatenated GZIP members/records. This class is needed because GZIPInputStream only finds the first GZIP member in the file even if the file is made up of multiple GZIP members.

Takes an InputStream stream that implements RepositionableStream interface so it can backup over-reads done by the zlib Inflater class.

Use the GzippedInputStream.iterator() method to get a gzip member iterator. Calls to Iterator.next returns the next gzip member in the stream. Cast return from Iterator.next to InputStream.

Use GzippedInputStream.gzipMemberSeek(long) to position stream before reading a gzip member if doing random accessing of gzip members. Pass it offset at which gzip member starts.

If you need to know position at which a gzip member starts, call GzippedInputStream.position() just after a call to Iterator.hasNext and before you call Iterator.next .
author:
   stack




Constructor Summary
public  GzippedInputStream(InputStream is)
    
public  GzippedInputStream(InputStream is, int size)
    

Method Summary
protected static  InputStreamcheckStream(InputStream is)
    
protected  booleancompareBytes(int a, int b)
    
protected  GzipHeadergetGzipHeader()
    
protected  InflatergetInflater()
    
protected  InputStreamgetInputStream()
    
public  longgotoEOR(int ignore)
     Exhaust current GZIP member content. Call this method when you think you're on the end of the GZIP member.
public  longgotoEOR()
     Exhaust current GZIP member content. Call this method when you think you're on the end of the GZIP member.
public static  byte[]gzip(byte[] bytes)
     Gzip passed bytes. Use only when bytes is small.
Parameters:
  bytes - What to gzip.
public  voidgzipMemberSeek(long position)
     Seek to a gzip member.
public  voidgzipMemberSeek()
    
public static  booleanisCompressedRepositionableStream(RepositionableStream rs)
     Tests passed stream is GZIP stream by reading in the HEAD. Does reposition of stream when done.
Parameters:
  rs - An InputStream that is Repositionable.
public static  booleanisCompressedStream(InputStream is)
     Tests passed stream is gzip stream by reading in the HEAD. Does not reposition stream when done.
Parameters:
  is - An InputStream.
public  Iteratoriterator()
     Returns a GZIP Member Iterator. Has limitations.
protected  booleanmoveToNextGzipMember()
    
public  voidposition(long position)
     Seek to passed offset.
public  longposition()
    
protected  voidreadHeader()
     Read in the gzip header.
protected  voidresetInflater()
     Move to next gzip member in the file.


Constructor Detail
GzippedInputStream
public GzippedInputStream(InputStream is) throws IOException(Code)



GzippedInputStream
public GzippedInputStream(InputStream is, int size) throws IOException(Code)

Parameters:
  is - An InputStream that implements RespositionableStream andreturns true when we callInputStream.markSupported (Latter is needed so can setupan Iterator against the Gzip stream).
Parameters:
  size - Size of blocks to use reading.
throws:
  IOException -




Method Detail
checkStream
protected static InputStream checkStream(InputStream is) throws IOException(Code)



compareBytes
protected boolean compareBytes(int a, int b)(Code)



getGzipHeader
protected GzipHeader getGzipHeader()(Code)



getInflater
protected Inflater getInflater()(Code)



getInputStream
protected InputStream getInputStream()(Code)



gotoEOR
public long gotoEOR(int ignore) throws IOException(Code)
Exhaust current GZIP member content. Call this method when you think you're on the end of the GZIP member. It will clean out any dross.
Parameters:
  ignore - Character to ignore counting characters (Usuallytrailing new lines). Count of characters skipped over.
throws:
  IOException -



gotoEOR
public long gotoEOR() throws IOException(Code)
Exhaust current GZIP member content. Call this method when you think you're on the end of the GZIP member. It will clean out any dross. Count of characters skipped over.
throws:
  IOException -



gzip
public static byte[] gzip(byte[] bytes) throws IOException(Code)
Gzip passed bytes. Use only when bytes is small.
Parameters:
  bytes - What to gzip. A gzip member of bytes.
throws:
  IOException -



gzipMemberSeek
public void gzipMemberSeek(long position) throws IOException(Code)
Seek to a gzip member. Moves stream to new position, resets inflater and reads in the gzip header ready for subsequent calls to read.
Parameters:
  position - Absolute position of a gzip member start.
throws:
  IOException -



gzipMemberSeek
public void gzipMemberSeek() throws IOException(Code)



isCompressedRepositionableStream
public static boolean isCompressedRepositionableStream(RepositionableStream rs) throws IOException(Code)
Tests passed stream is GZIP stream by reading in the HEAD. Does reposition of stream when done.
Parameters:
  rs - An InputStream that is Repositionable. True if compressed stream.
throws:
  IOException -



isCompressedStream
public static boolean isCompressedStream(InputStream is) throws IOException(Code)
Tests passed stream is gzip stream by reading in the HEAD. Does not reposition stream when done.
Parameters:
  is - An InputStream. True if compressed stream.
throws:
  IOException -



iterator
public Iterator iterator()(Code)
Returns a GZIP Member Iterator. Has limitations. Can only get one Iterator per instance of this class; you must get new instance if you want to get Iterator again. Iterator over GZIP Members.



moveToNextGzipMember
protected boolean moveToNextGzipMember()(Code)
True if we found another record in the stream.



position
public void position(long position) throws IOException(Code)
Seek to passed offset. After positioning the stream, it resets the inflater. Assumption is that public use of this method is only to position stream at start of a gzip member.
Parameters:
  position - Absolute position of a gzip member start.
throws:
  IOException -



position
public long position() throws IOException(Code)



readHeader
protected void readHeader() throws IOException(Code)
Read in the gzip header.
throws:
  IOException -



resetInflater
protected void resetInflater()(Code)
Move to next gzip member in the file.



Fields inherited from java.util.zip.GZIPInputStream
final public static int GZIP_MAGIC(Code)(Java Doc)
protected CRC32 crc(Code)(Java Doc)
protected boolean eos(Code)(Java Doc)

Methods inherited from java.util.zip.GZIPInputStream
public void close() throws IOException(Code)(Java Doc)
public int read(byte[] buf, int off, int len) throws IOException(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.