Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.openjpa.lib.xml
Class DocTypeReader

    java.lang.Object
      java.io.Reader
          org.apache.openjpa.lib.xml.DocTypeReader

All Implemented Interfaces:
  Closeable, Readable

    public class DocTypeReader

extends Reader

The DocTypeReader can be used to dynamically include a `DOCTYPE` declaration in an XML stream. Often it is inconvenient to specify a `DOCTYPE` in XML files -- you many want the option of parsing the files without reading the DTD, the files may move around, making placing a `DOCTYPE` path to the DTD in them unattractive, and you may have many files, making an in-line include of the DTD unattractive as well. This class makes it possible to maintain XML files without any `DOCTYPE` declaration, then dynamically include the `DOCTYPE` information at runtime. If the XML stream already contains a `DOCTYPE` declaration, the reader will not add an additional one. The `DOCTYPE` information given to the reader will be placed in the XML stream it wraps just before the root element of the document. Note that all methods other than the various forms of `read` apply onto the underlying XML stream and should not be used until the header and doc type have been read.

Author:
  Abe White

Field Summary

Fields inherited from class java.io.Reader
`lock`

Constructor Summary
`DocTypeReader(Reader xml, Reader docType)` Construct the reader with an XML stream, and set the `DOCTYPE` information to be included.

Method Summary
`void` | `close()`
`void` | `mark(int readAheadLimit)`
`boolean` | `markSupported()`
`int` | `read()`
`int` | `read(char[] buf)`
`int` | `read(char[] buf, int off, int len)`
`boolean` | `ready()`
`void` | `reset()`
`long` | `skip(long len)`

Methods inherited from class java.io.Reader
`read`

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

Constructor Detail

### DocTypeReader

    public DocTypeReader(Reader xml,
                         Reader docType)
                  throws IOException

  Construct the reader with an XML stream, and set the `DOCTYPE` information to be included. The given reader should access an input source containing the exact declaration to include, such as:
  `<DOCTYPE schedule SYSTEM "schedule.dtd">`
  `<DOCTYPE html PUBLIC "-//W3C//DTD XHTML ...>`
  `<DOCTYPE stock-price [ <ELEMENT symb ... ]>`
  If the reader is null, no `DOCTYPE` information will be included in the stream.

  Throws:
    `IOException`

Method Detail

### read

    public int read()
             throws IOException

  Overrides:
    `read` in class `Reader`
  Throws:
    `IOException`

### read

    public int read(char[] buf)
             throws IOException

  Overrides:
    `read` in class `Reader`
  Throws:
    `IOException`

### read

    public int read(char[] buf,
                    int off,
                    int len)
             throws IOException

  Specified by:
    `read` in class `Reader`
  Throws:
    `IOException`

### skip

    public long skip(long len)
              throws IOException

  Overrides:
    `skip` in class `Reader`
  Throws:
    `IOException`

### ready

    public boolean ready()
                  throws IOException

  Overrides:
    `ready` in class `Reader`
  Throws:
    `IOException`

### markSupported

    public boolean markSupported()

  Overrides:
    `markSupported` in class `Reader`

### mark

    public void mark(int readAheadLimit)
              throws IOException

  Overrides:
    `mark` in class `Reader`
  Throws:
    `IOException`

### reset

    public void reset()
               throws IOException

  Overrides:
    `reset` in class `Reader`
  Throws:
    `IOException`

### close

    public void close()
               throws IOException

  Specified by:
    `close` in interface `Closeable`
  Specified by:
    `close` in class `Reader`
  Throws:
    `IOException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006-2013 Apache Software Foundation. All Rights Reserved.