org.apache.flume.serialization.ResettableInputStream Java Examples
The following examples show how to use
org.apache.flume.serialization.ResettableInputStream.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MultiLineDeserializer.java From flume-customized with Apache License 2.0 | 5 votes |
MultiLineDeserializer(Context context, ResettableInputStream in) { this.in = in; this.outputCharset = Charset.forName( context.getString(OUT_CHARSET_KEY, CHARSET_DFLT)); this.maxLineLength = context.getInteger(MAXLINE_KEY, MAXLINE_DFLT); this.newLineStartPrefix = context.getString(NEW_LINE_START_PREFIX, START_PREFIX_DFLT); this.wrappedByDocker = context.getBoolean(WRAPPED_BY_DOCKER, DEFAULT_WRAPPED_BY_DOCKER); this.isOpen = true; }
Example #2
Source File: BlobDeserializer.java From mt-flume with Apache License 2.0 | 5 votes |
protected BlobDeserializer(Context context, ResettableInputStream in) { this.in = in; this.maxBlobLength = context.getInteger(MAX_BLOB_LENGTH_KEY, MAX_BLOB_LENGTH_DEFAULT); if (this.maxBlobLength <= 0) { throw new ConfigurationException("Configuration parameter " + MAX_BLOB_LENGTH_KEY + " must be greater than zero: " + maxBlobLength); } this.isOpen = true; }
Example #3
Source File: TestBlobDeserializer.java From mt-flume with Apache License 2.0 | 5 votes |
@Test public void testSimpleViaBuilder() throws IOException { ResettableInputStream in = new ResettableTestStringInputStream(mini); EventDeserializer.Builder builder = new BlobDeserializer.Builder(); EventDeserializer des = builder.build(new Context(), in); validateMiniParse(des); }
Example #4
Source File: TestBlobDeserializer.java From mt-flume with Apache License 2.0 | 5 votes |
@Test public void testSimpleViaFactory() throws IOException { ResettableInputStream in = new ResettableTestStringInputStream(mini); EventDeserializer des; des = EventDeserializerFactory.getInstance(BlobDeserializer.Builder.class.getName(), new Context(), in); validateMiniParse(des); }
Example #5
Source File: TestBlobDeserializer.java From mt-flume with Apache License 2.0 | 5 votes |
@Test public void testBatch() throws IOException { ResettableInputStream in = new ResettableTestStringInputStream(mini); EventDeserializer des = new BlobDeserializer(new Context(), in); List<Event> events; events = des.readEvents(10); // try to read more than we should have assertEquals(1, events.size()); assertEventBodyEquals(mini, events.get(0)); des.mark(); des.close(); }
Example #6
Source File: TestBlobDeserializer.java From mt-flume with Apache License 2.0 | 5 votes |
@Test public void testMaxLineLength() throws IOException { String longLine = "abcdefghijklmnopqrstuvwxyz\n"; Context ctx = new Context(); ctx.put(BlobDeserializer.MAX_BLOB_LENGTH_KEY, "10"); ResettableInputStream in = new ResettableTestStringInputStream(longLine); EventDeserializer des = new BlobDeserializer(ctx, in); assertEventBodyEquals("abcdefghij", des.readEvent()); assertEventBodyEquals("klmnopqrst", des.readEvent()); assertEventBodyEquals("uvwxyz\n", des.readEvent()); assertNull(des.readEvent()); }
Example #7
Source File: XmlXpathDeserializer.java From ingestion with Apache License 2.0 | 5 votes |
@Override public EventDeserializer build(Context context, ResettableInputStream in) { if (!(in instanceof Seekable)) { throw new IllegalArgumentException( "Cannot use this deserializer without a Seekable input stream"); } try { return new XmlXpathDeserializer(context, in); } catch (IOException ex) { throw new RuntimeException(ex); } }
Example #8
Source File: MultiLineDeserializer.java From flume-customized with Apache License 2.0 | 4 votes |
@Override public EventDeserializer build(Context context, ResettableInputStream in) { return new MultiLineDeserializer(context, in); }
Example #9
Source File: BlobDeserializer.java From mt-flume with Apache License 2.0 | 4 votes |
@Override public BlobDeserializer build(Context context, ResettableInputStream in) { return new BlobDeserializer(context, in); }
Example #10
Source File: TestBlobDeserializer.java From mt-flume with Apache License 2.0 | 4 votes |
@Test public void testSimple() throws IOException { ResettableInputStream in = new ResettableTestStringInputStream(mini); EventDeserializer des = new BlobDeserializer(new Context(), in); validateMiniParse(des); }
Example #11
Source File: ResettableInputStreamInputStream.java From ingestion with Apache License 2.0 | 4 votes |
public ResettableInputStreamInputStream(final ResettableInputStream in) { this.in = in; }
Example #12
Source File: XmlXpathDeserializerTest.java From ingestion with Apache License 2.0 | 4 votes |
private ResettableInputStream getTestInputStream() throws IOException { return getTestInputStream("test.xml"); }
Example #13
Source File: XmlXpathDeserializerTest.java From ingestion with Apache License 2.0 | 4 votes |
private ResettableInputStream getTestInputStream(final String path) throws IOException { return new ResettableFileInputStream(new File("src/test/resources/" + path), new TransientPositionTracker("dummy")); }