Code example for ArrayBlockingQueue

0
    public SurrogateReader(final InputStream stream, int queueSize) throws IOException {
        this.buffer = new StringBuilder(300);
        this.parsingValue = false;
        this.surrogate = null;
        this.elementName = null;
        this.surrogates = new ArrayBlockingQueue<DCEntry>(queueSize);
         
        Reader reader = new BufferedReader(new InputStreamReader(stream, "UTF-8"));
        this.inputSource = new InputSource(reader);
        this.inputSource.setEncoding("UTF-8");
        this.inputStream = stream;
         
        final SAXParserFactory factory = SAXParserFactory.newInstance();
        try { 
            this.saxParser = factory.newSAXParser();
        } catch (ParserConfigurationException e) {
            Log.logException(e);
            throw new IOException(e.getMessage());
        } catch (SAXException e) {
            Log.logException(e);
            throw new IOException(e.getMessage());