long sync() throws IOException { return mAvroFileWriter.sync(); } }
/** {@inheritDoc} */ @Override public long sync() throws IOException { return mAvroFileWriter.sync(); } }
/** {@inheritDoc} */ @Override public long sync() throws IOException { return mAvroFileWriter.sync(); } }
/** Calls {@linkplain #sync()} and then flushes the current state of the * file. */ @Override public void flush() throws IOException { sync(); vout.flush(); }
/** Calls {@linkplain #sync()} and then flushes the current state of the * file. */ @Override public void flush() throws IOException { sync(); vout.flush(); }
@Override public synchronized void storePosition(long position) throws IOException { metaCache.setOffset(position); writer.append(metaCache); writer.sync(); writer.flush(); }
long position = mDataFileWriter.sync();
private byte[] createDataFile(byte[] sync) throws IOException { Schema schema = Schema.create(Type.STRING); DataFileWriter<Utf8> w = new DataFileWriter<>(new GenericDatumWriter<>(schema)); ByteArrayOutputStream baos = new ByteArrayOutputStream(); w.create(schema, baos, sync); w.append(new Utf8("apple")); w.append(new Utf8("banana")); w.sync(); w.append(new Utf8("celery")); w.append(new Utf8("date")); w.sync(); w.append(new Utf8("endive")); w.append(new Utf8("fig")); w.close(); return baos.toByteArray(); }
currentCount++; writer.append(datum); writer.sync(); if (currentCount % 10 == 0) { flushCounter++;
writer.append(datum); if (++count%(COUNT/3) == 0) writer.sync(); // force some syncs mid-file if (count == 5) {
@Test public void testWriteAndRead() throws IOException { Schema schema = Schema.create(Type.STRING); // Write it DataFileWriter<Utf8> w = new DataFileWriter<>(new GenericDatumWriter<>(schema)); w.setCodec(CodecFactory.deflateCodec(6)); ByteArrayOutputStream baos = new ByteArrayOutputStream(); w.create(schema, baos); w.append(new Utf8("hello world")); w.append(new Utf8("hello moon")); w.sync(); w.append(new Utf8("bye bye world")); w.append(new Utf8("bye bye moon")); w.close(); // Read it DataFileStream<Utf8> r = new DataFileStream<>( new ByteArrayInputStream(baos.toByteArray()), new GenericDatumReader<>(schema)); assertEquals("hello world", r.next().toString()); assertEquals("hello moon", r.next().toString()); assertEquals("bye bye world", r.next().toString()); assertEquals("bye bye moon", r.next().toString()); assertFalse(r.hasNext()); } }
/** {@inheritDoc} */ @Override public long sync() throws IOException { return mAvroFileWriter.sync(); } }
/** {@inheritDoc} */ @Override public long sync() throws IOException { return mAvroFileWriter.sync(); } }
@Override public void flush() throws IOException { fileSize = dataFileWriter.sync(); }
/** Calls {@linkplain #sync()} and then flushes the current state of the * file. */ @Override public void flush() throws IOException { sync(); vout.flush(); }
/** Flush the current state of the file. */ @Override public void flush() throws IOException { sync(); vout.flush(); }
/** Flush the current state of the file. */ public void flush() throws IOException { sync(); vout.flush(); out.flush(); }
@Override public synchronized void storePosition(long position) throws IOException { metaCache.setOffset(position); writer.append(metaCache); writer.sync(); writer.flush(); }