Esempio n. 1
0
 public long skip(long l)
     throws IOException
 {
     long l1 = in.tell();
     long l2 = in.length() - l1;
     if (l2 > l)
     {
         in.seek(l);
         return in.tell() - l1;
     } else
     {
         in.seek(l2);
         return in.tell() - l1;
     }
 }
Esempio n. 2
0
 public void seek(long l)
     throws IOException
 {
     if (l < 0L)
     {
         throw new IOException((new StringBuilder()).append("Illegal seek: ").append(l).toString());
     } else
     {
         in.seek(l);
         return;
     }
 }
Esempio n. 3
0
 public static FileReader openReader(SeekableInput seekableinput, DatumReader datumreader)
     throws IOException
 {
     if (seekableinput.length() < (long)DataFileConstants.MAGIC.length)
     {
         throw new IOException("Not an Avro data file");
     }
     byte abyte0[] = new byte[DataFileConstants.MAGIC.length];
     seekableinput.seek(0L);
     for (int i = 0; i < abyte0.length; i = seekableinput.read(abyte0, i, abyte0.length - i)) { }
     seekableinput.seek(0L);
     if (Arrays.equals(DataFileConstants.MAGIC, abyte0))
     {
         return new DataFileReader(seekableinput, datumreader);
     }
     if (Arrays.equals(DataFileReader12.MAGIC, abyte0))
     {
         return new DataFileReader12(seekableinput, datumreader);
     } else
     {
         throw new IOException("Not an Avro data file");
     }
 }