コード例 #1
0
  public int read(byte b[], int off, int len) throws IOException {
    if (available() < len) {
      copyEvents(len);
    }

    return stream.getInputStream().read(b, off, len);
  }
コード例 #2
0
  public int read() throws IOException {
    if (available() == 0) {
      copyEvents(0x10000);
    }

    return stream.getInputStream().read();
  }
コード例 #3
0
  public SyntheticEventInputStream(XMLEventReader reader) {
    this.reader = reader;

    try {
      writer = Util.outputFactory.createXMLEventWriter(stream.getOutputStream());
    } catch (XMLStreamException e) {
      throw new RuntimeException(e);
    }
  }
コード例 #4
0
  private void copyEvents(int length) throws IOException {
    try {
      while (reader.hasNext() && stream.getInputStream().available() < length) {
        writer.add(reader.nextEvent());
      }

      writer.flush();
    } catch (XMLStreamException e) {
      throw new be.re.io.IOException(e);
    }
  }
コード例 #5
0
 public int available() throws IOException {
   return stream.getInputStream().available();
 }