Example #1
0
 public PDSInputStream(PDS pds, String member) throws IOException {
   this.pds = pds;
   if (pds == null || pds.data == null)
     throw new IOException("PDS member " + member + " not found");
   Object on = pds.directory.get(member);
   if (on == null) throw new IOException("PDS member " + member + " not found");
   left = ((PDSEntry) on).len;
   savedPosition = pds.getFilePointer();
   pds.seek((long) ((PDSEntry) on).loc);
 }
Example #2
0
 public int read(byte[] b, int off, int len) throws IOException {
   if (left <= 0) return -1;
   if (left < len) len = left;
   int n = pds.read(b, off, len);
   left -= n;
   return n;
 }
Example #3
0
 public int read() throws IOException {
   if (left <= 0) return -1;
   else {
     int c = pds.read();
     left--;
     return c;
   }
 }
Example #4
0
 public void close() throws IOException {
   pds.seek(savedPosition);
 }