Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright 2012-04-26 Werner Randelshofer
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.monte.media.jpeg
Class JFIFOutputStream

    java.lang.Object
      java.io.OutputStream
          org.monte.media.jpeg.JFIFOutputStream

All Implemented Interfaces:
  java.io.Closeable, java.io.Flushable

    public class JFIFOutputStream

extends java.io.OutputStream

`JFIFOutputStream`. This OutputStream supports writing of a JFIF stream.

References:
JPEG File Interchange Format Version 1.02
http://www.jpeg.org/public/jfif.pdf

Pennebaker, W., Mitchell, J. (1993).
JPEG Still Image Data Compression Standard.
Chapmann & Hall, New York.
ISBN 0-442-01272-1

Version:
  1.0 2011-02-27 Created.
Author:
  Werner Randelshofer

Field Summary
`static int` | `APP1_MARKER` APP1_MARKER Reserved for application use
`static int` | `APP2_MARKER` APP2_MARKER Reserved for application use
`static int` | `EOI_MARKER` End of image
`static int` | `JPG0_MARKER` Reserved for JPEG extensions
`static int` | `JPG1_MARKER`
`static int` | `JPG2_MARKER`
`static int` | `JPG3_MARKER`
`static int` | `JPG4_MARKER`
`static int` | `JPG5_MARKER`
`static int` | `JPG6_MARKER`
`static int` | `JPG7_MARKER`
`static int` | `JPG8_MARKER`
`static int` | `JPG9_MARKER`
`static int` | `JPGA_MARKER`
`static int` | `JPGB_MARKER`
`static int` | `JPGC_MARKER`
`static int` | `JPGD_MARKER`
`static int` | `RST0_MARKER`
`static int` | `RST1_MARKER`
`static int` | `RST2_MARKER`
`static int` | `RST3_MARKER`
`static int` | `RST4_MARKER`
`static int` | `RST5_MARKER`
`static int` | `RST6_MARKER`
`static int` | `RST7_MARKER`
`static int` | `SOF0_MARKER` Start of frame markers
`static int` | `SOF1_MARKER`
`static int` | `SOF2_MARKER`
`static int` | `SOF3_MARKER`
`static int` | `SOF5_MARKER`
`static int` | `SOF6_MARKER`
`static int` | `SOF7_MARKER`
`static int` | `SOF9_MARKER`
`static int` | `SOFA_MARKER`
`static int` | `SOFB_MARKER`
`static int` | `SOFD_MARKER`
`static int` | `SOFE_MARKER`
`static int` | `SOFF_MARKER`
`static int` | `SOI_MARKER` Start of image
`static int` | `SOS_MARKER` Start of scan
`static int` | `TEM_MARKER` Temporary private use in arithmetic coding

Constructor Summary
`JFIFOutputStream(java.io.File imgFile)`
`JFIFOutputStream(javax.imageio.stream.ImageOutputStream out)`

Method Summary
`void` | `close()`
`void` | `finish()`
`long` | `getSegmentLength()` Returns the length of the current segment or -1 if none has been pushed.
`long` | `getSegmentOffset()` Returns the offset of the current segment or -1 if none has been pushed.
`long` | `getStreamPosition()` Gets the position relative to the beginning of the IFF output stream.
`void` | `popSegment()`
`void` | `pushSegment(int marker)`
`void` | `seek(long newPosition)` Seeks relative to the beginning of the IFF output stream.
`void` | `write(byte[] b, int off, int len)` Writes stuffed or non-stuffed bytes to the underlying output stream.
`void` | `write(int b)` Writes a stuffed or non-stuffed byte to the underlying output stream.

Methods inherited from class java.io.OutputStream
`flush, write`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### SOI_MARKER

    public static final int SOI_MARKER

  Start of image

  See Also:
    Constant Field Values

### EOI_MARKER

    public static final int EOI_MARKER

  End of image

  See Also:
    Constant Field Values

### TEM_MARKER

    public static final int TEM_MARKER

  Temporary private use in arithmetic coding

  See Also:
    Constant Field Values

### SOS_MARKER

    public static final int SOS_MARKER

  Start of scan

  See Also:
    Constant Field Values

### APP1_MARKER

    public static final int APP1_MARKER

  APP1_MARKER Reserved for application use

  See Also:
    Constant Field Values

### APP2_MARKER

    public static final int APP2_MARKER

  APP2_MARKER Reserved for application use

  See Also:
    Constant Field Values

### JPG0_MARKER

    public static final int JPG0_MARKER

  Reserved for JPEG extensions

  See Also:
    Constant Field Values

### JPG1_MARKER

    public static final int JPG1_MARKER

See Also:
  Constant Field Values

### JPG2_MARKER

    public static final int JPG2_MARKER

See Also:
  Constant Field Values

### JPG3_MARKER

    public static final int JPG3_MARKER

See Also:
  Constant Field Values

### JPG4_MARKER

    public static final int JPG4_MARKER

See Also:
  Constant Field Values

### JPG5_MARKER

    public static final int JPG5_MARKER

See Also:
  Constant Field Values

### JPG6_MARKER

    public static final int JPG6_MARKER

See Also:
  Constant Field Values

### JPG7_MARKER

    public static final int JPG7_MARKER

See Also:
  Constant Field Values

### JPG8_MARKER

    public static final int JPG8_MARKER

See Also:
  Constant Field Values

### JPG9_MARKER

    public static final int JPG9_MARKER

See Also:
  Constant Field Values

### JPGA_MARKER

    public static final int JPGA_MARKER

See Also:
  Constant Field Values

### JPGB_MARKER

    public static final int JPGB_MARKER

See Also:
  Constant Field Values

### JPGC_MARKER

    public static final int JPGC_MARKER

See Also:
  Constant Field Values

### JPGD_MARKER

    public static final int JPGD_MARKER

See Also:
  Constant Field Values

### SOF0_MARKER

    public static final int SOF0_MARKER

  Start of frame markers

  See Also:
    Constant Field Values

### SOF1_MARKER

    public static final int SOF1_MARKER

See Also:
  Constant Field Values

### SOF2_MARKER

    public static final int SOF2_MARKER

See Also:
  Constant Field Values

### SOF3_MARKER

    public static final int SOF3_MARKER

See Also:
  Constant Field Values

### SOF5_MARKER

    public static final int SOF5_MARKER

See Also:
  Constant Field Values

### SOF6_MARKER

    public static final int SOF6_MARKER

See Also:
  Constant Field Values

### SOF7_MARKER

    public static final int SOF7_MARKER

See Also:
  Constant Field Values

### SOF9_MARKER

    public static final int SOF9_MARKER

See Also:
  Constant Field Values

### SOFA_MARKER

    public static final int SOFA_MARKER

See Also:
  Constant Field Values

### SOFB_MARKER

    public static final int SOFB_MARKER

See Also:
  Constant Field Values

### SOFD_MARKER

    public static final int SOFD_MARKER

See Also:
  Constant Field Values

### SOFE_MARKER

    public static final int SOFE_MARKER

See Also:
  Constant Field Values

### SOFF_MARKER

    public static final int SOFF_MARKER

See Also:
  Constant Field Values

### RST0_MARKER

    public static final int RST0_MARKER

See Also:
  Constant Field Values

### RST1_MARKER

    public static final int RST1_MARKER

See Also:
  Constant Field Values

### RST2_MARKER

    public static final int RST2_MARKER

See Also:
  Constant Field Values

### RST3_MARKER

    public static final int RST3_MARKER

See Also:
  Constant Field Values

### RST4_MARKER

    public static final int RST4_MARKER

See Also:
  Constant Field Values

### RST5_MARKER

    public static final int RST5_MARKER

See Also:
  Constant Field Values

### RST6_MARKER

    public static final int RST6_MARKER

See Also:
  Constant Field Values

### RST7_MARKER

    public static final int RST7_MARKER

See Also:
  Constant Field Values

Constructor Detail

### JFIFOutputStream

    public JFIFOutputStream(javax.imageio.stream.ImageOutputStream out)
                     throws java.io.IOException

Throws:
  `java.io.IOException`

### JFIFOutputStream

    public JFIFOutputStream(java.io.File imgFile)
                     throws java.io.IOException

Throws:
  `java.io.IOException`

Method Detail

### getStreamPosition

    public long getStreamPosition()
                           throws java.io.IOException

  Gets the position relative to the beginning of the IFF output stream.

  Usually this value is equal to the stream position of the underlying ImageOutputStream, but can be larger if the underlying stream already contained data.

  Returns:
    The relative stream position.
  Throws:
    `java.io.IOException`

### seek

    public void seek(long newPosition)
              throws java.io.IOException

  Seeks relative to the beginning of the IFF output stream.

  Usually this equal to seeking in the underlying ImageOutputStream, but can be different if the underlying stream already contained data.

  Throws:
    `java.io.IOException`

### pushSegment

    public void pushSegment(int marker)
                     throws java.io.IOException

  Throws:
    `java.io.IOException`

### popSegment

    public void popSegment()
                    throws java.io.IOException

  Throws:
    `java.io.IOException`

### getSegmentOffset

    public long getSegmentOffset()
                          throws java.io.IOException

  Returns the offset of the current segment or -1 if none has been pushed.

  Throws:
    `java.io.IOException`

### getSegmentLength

    public long getSegmentLength()
                          throws java.io.IOException

  Returns the length of the current segment or -1 if none has been pushed.

  Throws:
    `java.io.IOException`

### finish

    public void finish()
                throws java.io.IOException

  Throws:
    `java.io.IOException`

### close

    public void close()
               throws java.io.IOException

  Specified by:
    `close` in interface `java.io.Closeable`
  Overrides:
    `close` in class `java.io.OutputStream`
  Throws:
    `java.io.IOException`

### write

    public void write(byte[] b,
                      int off,
                      int len)
               throws java.io.IOException

  Writes stuffed or non-stuffed bytes to the underlying output stream. Bytes are stuffed, if the stream is not currently in a segment.

  Overrides:
    `write` in class `java.io.OutputStream`
  Throws:
    `java.io.IOException`

### write

    public void write(int b)
               throws java.io.IOException

  Writes a stuffed or non-stuffed byte to the underlying output stream. Bytes are stuffed, if the stream is not currently in a segment.

  Specified by:
    `write` in class `java.io.OutputStream`
  Throws:
    `java.io.IOException`

Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright 2012-04-26 Werner Randelshofer
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD