Code example for BufferedReader

Methods: close

0
      pPartition = PhysicalPartition.parsePhysicalPartitionString(physicalParitionParameter, "_");
    } 
 
    boolean startWin = Boolean.valueOf(startWinStr);
 
    BufferedReader in = new BufferedReader(new FileReader(fileStr));
 
    try 
    { 
      //PhysicalPartition pPartition = new PhysicalPartition(physicalPartitionId); 
      // TODO this should actually use DbusEventBufferAppendable (DDSDBUS-78) 
      DbusEventBuffer buf = (DbusEventBuffer)_eventBuffer.getDbusEventBufferAppendable(pPartition);
      if(buf == null)
        throw new RequestProcessingException("cannot find buffer for ph. partion " + pPartition);
 
      if ((buf.getMinScn() < 0) && (buf.getPrevScn() < 0)) buf.start(0);
 
      try 
      { 
        DbusEventsStatisticsCollector statsCollector = _relay.getInBoundStatsCollectors().getStatsCollector(pPartition.toSimpleString());
 
        int eventsAppended = 0;
        if (!((eventsAppended = DbusEventSerializable.appendToEventBuffer(in, buf, statsCollector, startWin))>0))
        { 
          throw new RequestProcessingException("event loading failed"); 
        } 
 
        StringBuilder res = new StringBuilder(20);
        res.append("{\"eventsAppended\":");
        res.append(eventsAppended);
        res.append("}");
 
        request.getResponseContent().write(ByteBuffer.wrap(res.toString().getBytes()));
      } 
      catch (InvalidEventException iee)
      { 
        throw new RequestProcessingException(iee);
      } 
      catch (RuntimeException re)
      { 
        LOG.error("runttime excception: " + re.getMessage(), re);
        throw re;
      } 
    } 
    finally 
    { 
      in.close();
    } 
 
    return request;
  }