code: @Override
      public void loadModel(InputStream modelIs) {
  
          ByteArrayOutputStream baos = new ByteArrayOutputStream();
          try {
              IOUtils.copy(modelIs, baos);
          } catch (IOException e) {
              LOG.error("Load model err.", e);
          }
  
          InputStream isForSVMLoad = new ByteArrayInputStream(baos.toByteArray());
          try (ZipInputStream zipInputStream = new ZipInputStream(isForSVMLoad)) {
              ZipEntry entry;
              while ((entry = zipInputStream.getNextEntry()) != null) {
                  if (entry.getName().endsWith(".model")) {
                      BufferedReader br = new BufferedReader(new InputStreamReader(zipInputStream, Charset.defaultCharset()));
                      this.model = svm.svm_load_model(br);
                  }
              }
  
          } catch (IOException e) {
              // Do Nothing.
          }
  
          modelIs = new ByteArrayInputStream(baos.toByteArray());
          try (ZipInputStream zipInputStream = new ZipInputStream(modelIs)) {
              ZipEntry entry;
              while ((entry = zipInputStream.getNextEntry()) != null) {
                  if (entry.getName().endsWith(".lbindexer")) {
                      String lbIndexer = IOUtils.toString(zipInputStream, Charset.defaultCharset());
                      this.labelIndexer = new LabelIndexer(new ArrayList<>());
                      this.labelIndexer.readFromSerializedString(lbIndexer);
                  }
              }
  
          } catch (IOException e) {
              LOG.error("Err in load LabelIndexer", e);
          }
  
      }
docs: We load twice because svm.svm_load_model will close the stream after load. so the next guy will have Steam closed exception.