@Test public void testMaxLineLength() throws IOException { String longLine = "abcdefghijklmnopqrstuvwxyz\n"; Context ctx = new Context(); ctx.put(LineDeserializer.MAXLINE_KEY, "10"); ResettableInputStream in = new ResettableTestStringInputStream(longLine); EventDeserializer des = new LineDeserializer(ctx, in); assertEventBodyEquals("abcdefghij", des.readEvent()); assertEventBodyEquals("klmnopqrst", des.readEvent()); assertEventBodyEquals("uvwxyz", des.readEvent()); Assert.assertNull(des.readEvent()); }
@Override public Event readEvent() throws IOException { ensureOpen(); String line = readLine(); if (line == null) { return null; } else { return EventBuilder.withBody(line, outputCharset); } }
LineDeserializer implements EventDeserializer { @Override public Event readEvent() throws IOException { ensureOpen(); String line = readLine(); if (line == null) { return null; } else { return EventBuilder.withBody(line, outputCharset); } } }
LineDeserializer implements EventDeserializer { @Override public Event readEvent() throws IOException { ensureOpen(); String line = readLine(); if (line == null) { return null; } else { return EventBuilder.withBody(line, outputCharset); } } LineDeserializer(Context context, ResettableInputStream in); }
LineDeserializer implements EventDeserializer { @Override public Event readEvent() throws IOException { ensureOpen(); String line = readLine(); if (line == null) { return null; } else { return EventBuilder.withBody(line, outputCharset); } } LineDeserializer(Context context, ResettableInputStream in); @Override Event readEvent(); @Override List<Event> readEvents(int numEvents); @Override void mark(); @Override void reset(); @Override void close(); }
LineDeserializer implements EventDeserializer { @Override public Event readEvent() throws IOException { ensureOpen(); String line = readLine(); if (line == null) { return null; } else { return EventBuilder.withBody(line, outputCharset); } } LineDeserializer(Context context, ResettableInputStream in); @Override Event readEvent(); @Override List<Event> readEvents(int numEvents); @Override void mark(); @Override void reset(); @Override void close(); static final String OUT_CHARSET_KEY; static final String CHARSET_DFLT; static final String MAXLINE_KEY; static final int MAXLINE_DFLT; }