Write password to outputstream depending on resource provided by saned.

@param resource as provided by sane in authorization request
@param password
@throws IOException
553954
private void writePassword(String resource, String password) throws IOException {
    String[] resourceParts = resource.split("\\$MD5\\$");
    if (resourceParts.length == 1) {
      // Write in clean
      outputStream.write(password);
    } else {
      outputStream.write("$MD5$" + SanePasswordEncoder.derivePassword(resourceParts[1], password));
    }
  }
1194715
public void write(final OutputStream out) throws IOException {
        if (this.byteOrder == ByteOrder.BIG_ENDIAN) {
            out.write(MAGIC_BIG_ENDIAN);
        } else {
            out.write(MAGIC_LITTLE_ENDIAN);
        }
        out.write(this.body);
    }
778942
public void store(Auth token) throws IOException {
        this.auths.put(token.getUser().getId(), token);
        this.authsByUser.put(token.getUser().getUsername(), token);

        String filename = token.getUser().getId() + ".auth";
        File outFile = new File(this.authStoreDir, filename);
        outFile.createNewFile();

        ObjectOutputStream authStream = new ObjectOutputStream(new FileOutputStream(outFile));
        authStream.writeObject(token);
        authStream.flush();
        authStream.close();
    }
444218
public void writeTo(final OutputStream outputStream) throws IOException {
        outputStream.write(getSigningKey());
        outputStream.write(getEncryptionKey());
    }
379197
public void write(OutputStream os)
    throws IOException
  {
    ByteCodeWriter out = new ByteCodeWriter(os, this);

    out.writeInt(MAGIC);
    out.writeShort(_minor);
    out.writeShort(_major);

    _constantPool.write(out);

    out.writeShort(_accessFlags);
    out.writeClass(_thisClass);
    out.writeClass(_superClass);

    out.writeShort(_interfaces.size());
    for (int i = 0; i < _interfaces.size(); i++) {
      String className = _interfaces.get(i);

      out.writeClass(className);
    }

    out.writeShort(_fields.size());
    for (int i = 0; i < _fields.size(); i++) {
      JavaField field = _fields.get(i);

      field.write(out);
    }

    out.writeShort(_methods.size());
    for (int i = 0; i < _methods.size(); i++) {
      JavaMethod method = _methods.get(i);

      method.write(out);
    }

    out.writeShort(_attributes.size());
    for (int i = 0; i < _attributes.size(); i++) {
      Attribute attr = _attributes.get(i);

      attr.write(out);
    }
  }
114592
public void write(final File folder) throws IOException {
    try (final DataInputStream keyStream = entry.getKeyStream();
         final DataInputStream valueStream = entry.getValueStream();) {
      final String containerId = keyStream.readUTF();
      try (final Writer outputWriter = new OutputStreamWriter(
          new FileOutputStream(new File(folder, containerId + ".txt")), StandardCharsets.UTF_8)) {
        this.writeFiles(valueStream, outputWriter);
      }
    }
  }
676970
public void write(final Writer outputWriter) throws IOException {
    try (final DataInputStream keyStream = entry.getKeyStream();
         final DataInputStream valueStream = entry.getValueStream();) {
      outputWriter.write("Container: ");
      outputWriter.write(keyStream.readUTF());
      outputWriter.write("\n");
      this.writeFiles(valueStream, outputWriter);
    }
  }
781610
protected void writeEntries(final StorageAwareResource resource, final ZipOutputStream zipOut) throws IOException {
    final BufferedOutputStream bufferedOutput = new BufferedOutputStream(zipOut);
    ZipEntry _zipEntry = new ZipEntry("emf-contents");
    zipOut.putNextEntry(_zipEntry);
    try {
      this.writeContents(resource, bufferedOutput);
    } finally {
      bufferedOutput.flush();
      zipOut.closeEntry();
    }
    ZipEntry _zipEntry_1 = new ZipEntry("resource-description");
    zipOut.putNextEntry(_zipEntry_1);
    try {
      this.writeResourceDescription(resource, bufferedOutput);
    } finally {
      bufferedOutput.flush();
      zipOut.closeEntry();
    }
    if (this.storeNodeModel) {
      ZipEntry _zipEntry_2 = new ZipEntry("node-model");
      zipOut.putNextEntry(_zipEntry_2);
      try {
        this.writeNodeModel(resource, bufferedOutput);
      } finally {
        bufferedOutput.flush();
        zipOut.closeEntry();
      }
    }
  }
135526
public String enpass(String password) throws IOException {
	  ByteArrayOutputStream baos = new ByteArrayOutputStream();
	  enpass(password,baos);
	  return new String(baos.toByteArray());
  }
269933
public void writeToStream(OutputStreamWithBuffer os)
    throws IOException
  {
    StreamImpl is = openReadImpl();

    try {
      byte []buffer = os.buffer();
      int offset = os.offset();
      int length = buffer.length;

      while (! os.isClosed()) {
        int sublen = length - offset;

        if (sublen <= 0) {
          buffer = os.nextBuffer(offset);
          offset = os.offset();
          sublen = length - offset;
        }

        sublen = is.read(buffer, offset, sublen);

        if (sublen <= 0) {
          os.offset(offset);
          return;
        }

        offset += sublen;
      }
    } finally {
      is.close();
    }
  }
701512
public Resource write(@NonNull Resource resource) throws IOException {
      Resource stringResource = new StringResource();
      try (PrintStream printStream = new PrintStream(stringResource.outputStream())) {
         print(printStream);
      }
      resource.write(stringResource.readToString());
      return resource;
   }
1372744
private void writeObject(ObjectOutputStream out) throws IOException {
        PutField fields = out.putFields();
        fields.put(AUTH_METHOD, authMethod);
        fields.put(ACCESS_ID, accessId);
        fields.put(SECURITY_NAME, securityName);
        out.writeFields();
    }
706137
private PasswordSource passwordSourceWithPrefix(
            final NodeSSHConnectionInfo nodeAuthentication,
            final String prefix
    ) throws IOException
    {
        if (null != nodeAuthentication.getSudoPasswordStoragePath(prefix)) {
            return new BasicSource(nodeAuthentication.getSudoPasswordStorageData(prefix));
        } else {
            return new BasicSource(nodeAuthentication.getSudoPassword(prefix));
        }
    }
602494
public void write(DataOutput out) throws IOException {
    UTF8.writeString(out, file);
    out.writeLong(start);
    out.writeLong(length);
  }
498010
@Override
    public void setPassword(String password) {
        room.setPassword(password);
        apiRoom.setPassword(password);
    }
192956
public function serialize($resource, OutputStream $out): OutputStream
    {
        if (is_object($resource) && method_exists($resource, '__toString')) {
            $out->write((string) $resource);
        } elseif (is_object($resource) || is_array($resource)) {
            $out->write(var_export($resource, true));
        } elseif (is_bool($resource) && $resource) {
            $out->write('true');
        } elseif (is_bool($resource) && !$resource) {
            $out->write('false');
        } else {
            $out->write((string) $resource);
        }

        return $out;
    }
723339
public long depass(final String password, final OutputStream os) throws IOException {
	  int offset = password.startsWith(ENC)?4:0;
	  final ByteArrayOutputStream baos = new ByteArrayOutputStream();
	  final ByteArrayInputStream bais =  new ByteArrayInputStream(password.getBytes(),offset,password.length()-offset);
	  exec(new AESExec() {
		@Override
		public void exec(AES aes) throws IOException {
			  CipherOutputStream cos = aes.outputStream(baos, false);
			  decode(bais,cos);
			  cos.close(); // flush
		}
	  });
	  byte[] bytes = baos.toByteArray();
	  DataInputStream dis = new DataInputStream(new ByteArrayInputStream(bytes));
	  long time;
	  if(this.getClass().getSimpleName().startsWith("base64")) { // don't expose randomization
		  os.write(bytes);
		  time = 0L;
	  } else {
		  int start=0;
		  for(int i=0;i<3;++i) {
			  start+=Math.abs(dis.readByte());
		  }
		  start%=0x7;
		  for(int i=0;i<start;++i) {
			  dis.readByte();
		  }
		  time = (dis.readInt() & 0xFFFF)|(System.currentTimeMillis()&0xFFFF0000);
		  int minlength = dis.readByte();
		  if(minlength<0x9){
			DataOutputStream dos = new DataOutputStream(os);
			for(int i=0;i<minlength;++i) {
				dis.readByte();
				dos.writeByte(dis.readByte());
			}
		  } else {
			  int pre =((Byte.SIZE*3+Integer.SIZE+Byte.SIZE)/Byte.SIZE)+start; 
			  os.write(bytes, pre, bytes.length-pre);
		  }
	  }
	  return time;
  }