Exemplo n.º 1
0
 public void close() {
   if (input == null) {
     return;
   }
   buf = null;
   try {
     input.close();
   } catch (IOException ignored) {
   }
   input = null;
 }
Exemplo n.º 2
0
 public boolean next() throws IOException {
   for (; ; ) {
     if (buf == null || !buf.hasRemaining()) {
       if (input == null) {
         return false;
       }
       buf = input.readNext();
       limit = buf == null ? 0 : buf.limit();
       if (limit <= 0) {
         close();
         return false;
       }
     }
     modificationTime = buf.getLong();
     filesize = buf.getLong();
     replication = buf.getInt();
     final int nameLen = buf.getInt();
     isDirectory = buf.get() != 0;
     numStripes = buf.getInt();
     numRecoveryStripes = buf.getInt();
     striperType = buf.getInt();
     stripeSize = buf.getInt();
     owner = buf.getInt();
     group = buf.getInt();
     mode = buf.getShort();
     fileId = buf.getLong();
     fileCount = isDirectory ? buf.getLong() : 0;
     dirCount = isDirectory ? buf.getLong() : 0;
     final int onameLen = buf.getInt();
     final int gnameLen = buf.getInt();
     owner &= 0xFFFFFFFFL;
     group &= 0xFFFFFFFFL;
     mode &= 0xFFFF;
     filename = readString(nameLen);
     if (owner == prevOwner && ownerName != null) {
       skip(onameLen);
     } else {
       prevOwner = owner;
       ownerName = readString(onameLen);
     }
     if (group == prevGroup && groupName != null) {
       skip(gnameLen);
     } else {
       prevGroup = group;
       groupName = readString(gnameLen);
     }
     if (nameLen > 0) {
       break;
     }
   }
   return true;
 }