//
 // Methods from InputStream
 // Since Java does not have multiple inheritance, we have to
 //  explicitly expose InputStream's methods as part of our interface
 //
 public int read() throws IOException {
   ensureReadyOnFirstUse();
   long remain = getBytesRemaining();
   // System.out.println("SICW.read()  remain: " + remain);
   if (remain <= 0) return -1;
   return streamDataInput.read();
 }
 public int read(byte[] buffer, int offset, int length) throws IOException {
   ensureReadyOnFirstUse();
   long remain = getBytesRemaining();
   // System.out.println("SICW.read( "+length+" )  remain: " + remain);
   if (remain <= 0) return -1;
   length = (int) Math.min(Math.min(remain, (long) length), (long) Integer.MAX_VALUE);
   return streamDataInput.read(buffer, offset, length);
 }
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");
     }
 }
Esempio n. 4
0
 public int read(byte abyte0[], int i, int j)
     throws IOException
 {
     return in.read(abyte0, i, j);
 }
Esempio n. 5
0
 public int read(byte abyte0[])
     throws IOException
 {
     return in.read(abyte0, 0, abyte0.length);
 }