@Override public int read(byte[] b, int off, int len) throws IOException { return in.read(b, off, len); }
@Override public int read(byte[] b) throws IOException { return in.read(b, 0, b.length); }
@Override public int read(byte[] b) throws IOException { return in.read(b, 0, b.length); }
@Override public int read(byte[] b, int off, int len) throws IOException { return in.read(b, off, len); }
/** Open a reader for a file. */ public static <D> FileReader<D> openReader(SeekableInput in, DatumReader<D> reader) throws IOException { if (in.length() < MAGIC.length) throw new IOException("Not an Avro data file"); // read magic header byte[] magic = new byte[MAGIC.length]; in.seek(0); for (int c = 0; c < magic.length; c = in.read(magic, c, magic.length-c)) {} in.seek(0); if (Arrays.equals(MAGIC, magic)) // current format return new DataFileReader<D>(in, reader); if (Arrays.equals(DataFileReader12.MAGIC, magic)) // 1.2 format return new DataFileReader12<D>(in, reader); throw new IOException("Not an Avro data file"); }
/** Open a reader for a file. */ public static <D> FileReader<D> openReader(SeekableInput in, DatumReader<D> reader) throws IOException { if (in.length() < MAGIC.length) throw new InvalidAvroMagicException("Not an Avro data file"); // read magic header byte[] magic = new byte[MAGIC.length]; in.seek(0); for (int c = 0; c < magic.length; c = in.read(magic, c, magic.length-c)) {} in.seek(0); if (Arrays.equals(MAGIC, magic)) // current format return new DataFileReader<>(in, reader); if (Arrays.equals(DataFileReader12.MAGIC, magic)) // 1.2 format return new DataFileReader12<>(in, reader); throw new InvalidAvroMagicException("Not an Avro data file"); }
@Override public int read(byte[] b, int off, int len) throws IOException { return in.read(b, off, len); }
@Override public int read(byte[] b, int off, int len) throws IOException { return in.read(b, off, len); }
@Override public int read(byte[] b) throws IOException { return in.read(b, 0, b.length); }
@Override public int read(byte[] b) throws IOException { return in.read(b, 0, b.length); }
@Override public int read(byte[] b) throws IOException { return in.read(b, 0, b.length); }
@Override public int read(byte[] b, int off, int len) throws IOException { return in.read(b, off, len); }
@Override public int read(byte[] b, int off, int len) throws IOException { return in.read(b, off, len); }
@Override public int read(byte[] b) throws IOException { return in.read(b, 0, b.length); }
/** Open a reader for a file. */ public static <D> FileReader<D> openReader(SeekableInput in, DatumReader<D> reader) throws IOException { if (in.length() < MAGIC.length) throw new IOException("Not an Avro data file"); // read magic header byte[] magic = new byte[MAGIC.length]; in.seek(0); for (int c = 0; c < magic.length; c = in.read(magic, c, magic.length-c)) {} in.seek(0); if (Arrays.equals(MAGIC, magic)) // current format return new DataFileReader<D>(in, reader); if (Arrays.equals(DataFileReader12.MAGIC, magic)) // 1.2 format return new DataFileReader12<D>(in, reader); throw new IOException("Not an Avro data file"); }
/** Open a reader for a file. */ public static <D> FileReader<D> openReader(SeekableInput in, DatumReader<D> reader) throws IOException { if (in.length() < MAGIC.length) throw new IOException("Not an Avro data file"); // read magic header byte[] magic = new byte[MAGIC.length]; in.seek(0); for (int c = 0; c < magic.length; c = in.read(magic, c, magic.length-c)) {} in.seek(0); if (Arrays.equals(MAGIC, magic)) // current format return new DataFileReader<D>(in, reader); if (Arrays.equals(DataFileReader12.MAGIC, magic)) // 1.2 format return new DataFileReader12<D>(in, reader); throw new IOException("Not an Avro data file"); }