intarsys runtime library

de.intarsys.tools.reader
Class TaggedReader

java.lang.Object
  extended by java.io.Reader
      extended by de.intarsys.tools.reader.TaggedReader
All Implemented Interfaces:
Closeable, Readable

public class TaggedReader
extends Reader

This reader extracts meta information from the data header.

The syntax for an entry is

 '$$$' ws* key ws* '=' value '\n'
 value = string | quoted_string
 quoted_string = '"' [ char | escape ]* '"'
 
Meta data is scanned until the first line not starting with '$$$'. So the first character returned is the first character on the first line not starting with '$$$'.


Constructor Summary
TaggedReader(Reader reader, int size)
           
 
Method Summary
 void close()
           
 String getEncoding()
           
 String getProperty(String name)
           
 Iterator<String> getPropertyNames()
           
 void mark(int readAheadLimit)
           
 boolean markSupported()
           
 void putProperty(String name, String value)
           
 int read()
           
 int read(char[] cbuf, int off, int len)
           
 boolean ready()
           
 void reset()
           
 long skip(long n)
           
 
Methods inherited from class java.io.Reader
read, read
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TaggedReader

public TaggedReader(Reader reader,
                    int size)
             throws IOException
Throws:
IOException
Method Detail

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Specified by:
close in class Reader
Throws:
IOException

getEncoding

public String getEncoding()

getProperty

public String getProperty(String name)

getPropertyNames

public Iterator<String> getPropertyNames()

mark

public void mark(int readAheadLimit)
          throws IOException
Overrides:
mark in class Reader
Throws:
IOException

markSupported

public boolean markSupported()
Overrides:
markSupported in class Reader

putProperty

public void putProperty(String name,
                        String value)

read

public int read()
         throws IOException
Overrides:
read in class Reader
Throws:
IOException

read

public int read(char[] cbuf,
                int off,
                int len)
         throws IOException
Specified by:
read in class Reader
Throws:
IOException

ready

public boolean ready()
              throws IOException
Overrides:
ready in class Reader
Throws:
IOException

reset

public void reset()
           throws IOException
Overrides:
reset in class Reader
Throws:
IOException

skip

public long skip(long n)
          throws IOException
Overrides:
skip in class Reader
Throws:
IOException

intarsys runtime library

Copyright © 2012 intarsys consulting GmbH. All Rights Reserved.