Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

11
LINES

< > BotCompany Repo | #1031474 // inputStreamForFileInDirOrZip

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2765L/16K).

// subPath is relative and with slashes
static InputStream inputStreamForFileInDirOrZip(File location, S subPath) ctex {
  if (location.isDirectory()) {
    File f = new File(location, subPath);
    ret f.exists() ? newFileInputStream(f) : null;
  } else if (location.isFile()) {
    InputStream in = zipFileInputStream(location, subPath);
    if (in != null) ret in;
  }
  null;
}

Author comment

Began life as a copy of #1012231

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1031474
Snippet name: inputStreamForFileInDirOrZip
Eternal ID of this version: #1031474/4
Text MD5: 8af744851a882bd3c95ca9de6be1b172
Transpilation MD5: 2a13f010930e3733f02398149b4d831e
Author: stefan
Category: javax / io
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-14 05:24:53
Source code size: 391 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 147 / 194
Version history: 3 change(s)
Referenced in: [show references]