Java Doc for FileCodestreamWriter.java in  » 6.0-JDK-Modules » Java-Advanced-Imaging » jj2000 » j2k » codestream » writer » 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 » 6.0 JDK Modules » Java Advanced Imaging » jj2000.j2k.codestream.writer 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   jj2000.j2k.codestream.writer.CodestreamWriter
      jj2000.j2k.codestream.writer.FileCodestreamWriter

FileCodestreamWriter
public class FileCodestreamWriter extends CodestreamWriter implements Markers(Code)
This class implements a CodestreamWriter for Java streams. The streams can be files or network connections, or any other resource that presents itself as a OutputStream. See the CodestreamWriter abstract class for more details on the implementation of the CodestreamWriter abstract class.

Before any packet data is written to the bit stream (even in simulation mode) the complete header should be written to the HeaderEncoder object supplied to the constructor, following the procedure explained in the HeaderEncoder class. Otherwise incorrect estimates are given by getMaxAvailableBytes() for rate allocation.
See Also:   CodestreamWriter
See Also:   HeaderEncoder



Field Summary
public static  intDEF_BUF_LEN
    
 byteephMarker
    
 intndata
     The number of bytes already written to the bit stream, excluding the header length, magic number and header length info.
 intpacketIdx
     The packet index (when start of packet markers i.e.
 bytesopMarker
    

Constructor Summary
public  FileCodestreamWriter(File file, int mb)
     Opens the file 'file' for writing the bit stream, using the 'he' header encoder.
public  FileCodestreamWriter(String fname, int mb)
     Opens the file named 'fname' for writing the bit stream, using the 'he' header encoder.
public  FileCodestreamWriter(OutputStream os, int mb)
     Uses the output stream 'os' for writing the bit stream, using the 'he' header encoder.

Method Summary
public  voidclose()
     Writes the EOC marker and closes the underlying stream.
public  voidcommitBitstreamHeader(HeaderEncoder he)
     Writes the header data in the codestream and actualize ndata with the header length.
public  intgetLength()
     Returns the current length of the entire bit stream.
final public  intgetMaxAvailableBytes()
     Returns the number of bytes remaining available in the bit stream.
public  intgetOffLastROIPkt()
    
public  intwritePacketBody(byte body, int blen, boolean sim, boolean roiInPkt, int roiLen)
     Writes a packet body to the bit stream and returns the number of bytes used by this body .If in simulation mode then no data is written to the bit stream but the number of bytes is calculated.
public  intwritePacketHead(byte head, int hlen, boolean sim, boolean sop, boolean eph)
     Writes a packet head to the bit stream and returns the number of bytes used by this header.

Field Detail
DEF_BUF_LEN
public static int DEF_BUF_LEN(Code)
The default buffer length, 1024 bytes



ephMarker
byte ephMarker(Code)
Array used to store the EPH markers values



ndata
int ndata(Code)
The number of bytes already written to the bit stream, excluding the header length, magic number and header length info.



packetIdx
int packetIdx(Code)
The packet index (when start of packet markers i.e. SOP markers) are used.



sopMarker
byte sopMarker(Code)
Array used to store the SOP markers values




Constructor Detail
FileCodestreamWriter
public FileCodestreamWriter(File file, int mb) throws IOException(Code)
Opens the file 'file' for writing the bit stream, using the 'he' header encoder. The magic number is written to the bit stream. Normally, the header encoder must be empty (i.e. no data has been written to it yet). A BufferedOutputStream is used on top of the file to increase throughput, the length of the buffer is DEF_BUF_LEN.
Parameters:
  file - The file where to write the bit stream
Parameters:
  mb - The maximum number of bytes that can be written to the bitstream.
exception:
  IOException - If an error occurs while trying to open the filefor writing or while writing the magic number.



FileCodestreamWriter
public FileCodestreamWriter(String fname, int mb) throws IOException(Code)
Opens the file named 'fname' for writing the bit stream, using the 'he' header encoder. The magic number is written to the bit stream. Normally, the header encoder must be empty (i.e. no data has been written to it yet). A BufferedOutputStream is used on top of the file to increase throughput, the length of the buffer is DEF_BUF_LEN.
Parameters:
  fname - The name of file where to write the bit stream
Parameters:
  mb - The maximum number of bytes that can be written to the bitstream.
Parameters:
  encSpec - The encoder's specifications
exception:
  IOException - If an error occurs while trying to open the filefor writing or while writing the magic number.



FileCodestreamWriter
public FileCodestreamWriter(OutputStream os, int mb) throws IOException(Code)
Uses the output stream 'os' for writing the bit stream, using the 'he' header encoder. The magic number is written to the bit stream. Normally, the header encoder must be empty (i.e. no data has been written to it yet). No BufferedOutputStream is used on top of the output stream 'os'.
Parameters:
  os - The output stream where to write the bit stream.
Parameters:
  mb - The maximum number of bytes that can be written to the bitstream.
exception:
  IOException - If an error occurs while writing the magicnumber to the 'os' output stream.




Method Detail
close
public void close() throws IOException(Code)
Writes the EOC marker and closes the underlying stream.
exception:
  IOException - If an error occurs while closing the underlyingstream.



commitBitstreamHeader
public void commitBitstreamHeader(HeaderEncoder he) throws IOException(Code)
Writes the header data in the codestream and actualize ndata with the header length. The header is either a MainHeaderEncoder or a TileHeaderEncoder.
Parameters:
  he - The current header encoder.
exception:
  IOException - If an I/O error occurs while writing the data.



getLength
public int getLength()(Code)
Returns the current length of the entire bit stream. the current length of the bit stream



getMaxAvailableBytes
final public int getMaxAvailableBytes()(Code)
Returns the number of bytes remaining available in the bit stream. This is the maximum allowed number of bytes minus the number of bytes that have already been written to the bit stream. If more bytes have been written to the bit stream than the maximum number of allowed bytes, then a negative value is returned. The number of bytes remaining available in the bit stream.



getOffLastROIPkt
public int getOffLastROIPkt()(Code)
Gives the offset of the end of last packet containing ROI information End of last ROI packet



writePacketBody
public int writePacketBody(byte body, int blen, boolean sim, boolean roiInPkt, int roiLen) throws IOException(Code)
Writes a packet body to the bit stream and returns the number of bytes used by this body .If in simulation mode then no data is written to the bit stream but the number of bytes is calculated. This can be used for iterative rate allocation.

If the length of the data that is to be written to the bit stream is more than the space left (as returned by getMaxAvailableBytes()) only the data that does not exceed the allowed length is written, the rest is discarded. However the value returned by the method is the total length of the packet body , as if all of it was written to the bit stream.
Parameters:
  body - The packet body data.
Parameters:
  blen - The number of bytes in the packet body.
Parameters:
  sim - Simulation mode flag. If true nothing is written to the bitstream, but the number of bytes that would be written is returned.
Parameters:
  roiInPkt - Whether or not this packet contains ROI information
Parameters:
  roiLen - Number of byte to read in packet body to get all the ROIinformation The number of bytes spent by the packet body.
exception:
  IOException - If an I/O error occurs while writing to theoutput stream.
See Also:   FileCodestreamWriter.commitBitstreamHeader




writePacketHead
public int writePacketHead(byte head, int hlen, boolean sim, boolean sop, boolean eph) throws IOException(Code)
Writes a packet head to the bit stream and returns the number of bytes used by this header. It returns the total number of bytes that the packet head takes in the bit stream. If in simulation mode then no data is written to the bit stream but the number of bytes is calculated. This can be used for iterative rate allocation.

If the length of the data that is to be written to the bit stream is more than the space left (as returned by getMaxAvailableBytes()) only the data that does not exceed the allowed length is written, the rest is discarded. However the value returned by the method is the total length of the packet, as if all of it was written to the bit stream.

If the bit stream header has not been commited yet and 'sim' is false, then the bit stream header is automatically commited (see commitBitstreamHeader() method) before writting the packet.
Parameters:
  head - The packet head data.
Parameters:
  hlen - The number of bytes in the packet head.
Parameters:
  sim - Simulation mode flag. If true nothing is written to the bitstream, but the number of bytes that would be written is returned.
Parameters:
  sop - Start of packet header marker flag. This flag indicateswhether or not SOP markers should be written. If true, SOP markersshould be written, if false, they should not.
Parameters:
  eph - End of Packet Header marker flag. This flag indicateswhether or not EPH markers should be written. If true, EPH markersshould be written, if false, they should not. The number of bytes spent by the packet head.
exception:
  IOException - If an I/O error occurs while writing to theoutput stream.
See Also:   FileCodestreamWriter.commitBitstreamHeader




Fields inherited from jj2000.j2k.codestream.writer.CodestreamWriter
protected int maxBytes(Code)(Java Doc)
protected int ndata(Code)(Java Doc)

Methods inherited from jj2000.j2k.codestream.writer.CodestreamWriter
abstract public void close() throws IOException(Code)(Java Doc)
abstract public void commitBitstreamHeader(HeaderEncoder he) throws IOException(Code)(Java Doc)
abstract public int getLength()(Code)(Java Doc)
abstract public int getMaxAvailableBytes()(Code)(Java Doc)
abstract public int getOffLastROIPkt()(Code)(Java Doc)
abstract public int writePacketBody(byte body, int blen, boolean sim, boolean roiInPkt, int roiLen) throws IOException(Code)(Java Doc)
abstract public int writePacketHead(byte head, int hlen, boolean sim, boolean sop, boolean eph) throws IOException(Code)(Java Doc)

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.