Store to json.

@param props
the props
@param os
the os
@param header
the header
@param encoding
the encoding
@throws IOException
Signals that an I/O exception has occurred.
778121
public void storeToYAML(final Properties props, final OutputStream os, final String header, final String encoding)
			throws IOException {
		try {
			((PrefixedProperties) props).storeToYAML(os, header, encoding);
		} catch (final ClassCastException err) {
			throw new IOException(
					"Cannot store properties JSON file - not using PrefixedProperties: " + err.getMessage());
		}
	}
632491
protected JsonWriter property(String key, Iterator<?> iterator) throws IOException {
      return property(key, Collect.asIterable(iterator));
   }
1228077
void writeObject(java.io.ObjectOutputStream out) throws IOException {
        // when using object serialization, write the json bytes
        byte[] bytes = toString().getBytes(StandardCharsets.UTF_8);
        out.writeInt(bytes.length);
        out.write(bytes);
    }
219914
private void storeFileHashCache(Properties props) {
        File cacheFile = new File(this.targetDirectory, CACHE_PROPERTIES_FILENAME);
        try (OutputStream out = new BufferedOutputStream(new FileOutputStream(cacheFile))) {
            props.store(out, null);
        } catch (IOException e) {
            getLog().warn("Cannot store file hash cache properties file", e);
        }
    }
783335
public void storeFlattened(final OutputStream out) throws IOException {
    final Properties p = new Properties();
    for (Props curr = this; curr != null; curr = curr.getParent()) {
      for (final String key : curr.localKeySet()) {
        if (!p.containsKey(key)) {
          p.setProperty(key, get(key));
        }
      }
    }

    p.store(out, null);
  }
1038509
public void writeToOutputStream(OutputStream os) throws IOException {
		if(sb == null) {
			throw new IllegalStateException("No interal StringBuffer");
		}
		byte[] b;
		try {
			b = getBytes();
		} catch (UnsupportedEncodingException e) {
			throw new RuntimeException(e);
		}
		os.write(b);
	}
808167
private void writeObject (ObjectOutputStream s)
        throws IOException
    {
        // write out number of buckets
        s.writeInt(_buckets.length);
        s.writeFloat(_loadFactor);

        // write out size (number of mappings)
        s.writeInt(_size);

        // write out keys and values
        for (IntIntEntry entry : entrySet()) {
            s.writeInt(entry.getIntKey());
            s.writeInt(entry.getIntValue());
        }
    }
1208779
public void writeExternal(ObjectOutput out) throws IOException
   {
      byte[] buf = id.getBytes(Constants.DEFAULT_ENCODING);
      out.writeInt(buf.length);
      out.write(buf);
      
      if (parentId == null)
      {
         out.writeInt(-1);
      }
      else
      {
         buf = parentId.getBytes(Constants.DEFAULT_ENCODING);
         out.writeInt(buf.length);
         out.write(buf);
      }
      if (name == null)
      {
         out.writeInt(-1);
      }
      else
      {
         buf = name.getAsString(true).getBytes(Constants.DEFAULT_ENCODING);
         out.writeInt(buf.length);
         out.write(buf);
      }
      if (path == null)
      {
         out.writeInt(-1);
      }
      else
      {
         buf = path.getAsString().getBytes(Constants.DEFAULT_ENCODING);
         out.writeInt(buf.length);
         out.write(buf);
      }
   }
106442
private void encodeHeader(ByteBuf out, CharSequence name, CharSequence value, boolean sensitive, long headerSize) {
        // If the header value is sensitive then it must never be indexed
        if (sensitive) {
            int nameIndex = getNameIndex(name);
            encodeLiteral(out, name, value, IndexType.NEVER, nameIndex);
            return;
        }

        // If the peer will only use the static table
        if (maxHeaderTableSize == 0) {
            int staticTableIndex = HpackStaticTable.getIndex(name, value);
            if (staticTableIndex == -1) {
                int nameIndex = HpackStaticTable.getIndex(name);
                encodeLiteral(out, name, value, IndexType.NONE, nameIndex);
            } else {
                encodeInteger(out, 0x80, 7, staticTableIndex);
            }
            return;
        }

        // If the headerSize is greater than the max table size then it must be encoded literally
        if (headerSize > maxHeaderTableSize) {
            int nameIndex = getNameIndex(name);
            encodeLiteral(out, name, value, IndexType.NONE, nameIndex);
            return;
        }

        HeaderEntry headerField = getEntry(name, value);
        if (headerField != null) {
            int index = getIndex(headerField.index) + HpackStaticTable.length;
            // Section 6.1. Indexed Header Field Representation
            encodeInteger(out, 0x80, 7, index);
        } else {
            int staticTableIndex = HpackStaticTable.getIndex(name, value);
            if (staticTableIndex != -1) {
                // Section 6.1. Indexed Header Field Representation
                encodeInteger(out, 0x80, 7, staticTableIndex);
            } else {
                ensureCapacity(headerSize);
                encodeLiteral(out, name, value, IndexType.INCREMENTAL, getNameIndex(name));
                add(name, value, headerSize);
            }
        }
    }
976680
public static void saveJson(File json, Object object) throws IOException {
        objectMapper.writer().writeValue(json, object);
    }
641165
public static Props fromJSONString(final String json) throws IOException {
    final Map<String, String> obj = (Map<String, String>) JSONUtils.parseJSONFromString(json);
    final Props props = new Props(null, obj);
    return props;
  }
650180
public static void writeJson(@javax.annotation.Nonnull final OutputStream out, final Object obj) throws IOException {
    final ObjectMapper mapper = new ObjectMapper().enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL)
      .enable(SerializationFeature.INDENT_OUTPUT);
    @javax.annotation.Nonnull final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
    mapper.writeValue(buffer, obj);
    out.write(buffer.toByteArray());
  }
523
public void encode(OutputStream out) throws IOException {
        DerOutputStream  tmp = new DerOutputStream();
        if (extensionValue == null) {
            extensionId = PKIXExtensions.CertificateIssuer_Id;
            critical = true;
            encodeThis();
        }
        super.encode(tmp);
        out.write(tmp.toByteArray());
    }
1268367
private static void writeTextToResponse(final HttpServletResponse res, final String text) throws IOException {
		res.setCharacterEncoding(UTF_8);
		res.setContentType(TEXT_X_JSON);
		PrintWriter writer = res.getWriter();
		writer.write(text);
		writer.flush();
	}
769450
private void writeHeaders(final YokeRequest request, final FileProps props) {

        MultiMap headers = request.response().headers();

        if (!headers.contains("etag")) {
            headers.set("etag", "\"" + props.size() + "-" + props.lastModifiedTime() + "\"");
        }

        if (!headers.contains("date")) {
            headers.set("date", format(new Date()));
        }

        if (!headers.contains("cache-control")) {
            headers.set("cache-control", "public, max-age=" + maxAge / 1000);
        }

        if (!headers.contains("last-modified")) {
            headers.set("last-modified", format(new Date(props.lastModifiedTime())));
        }
    }
1201535
private void writeObject(ObjectOutputStream out) throws IOException {
		super.write(out);
		out.writeUTF(this.mapreduceInputFormat.getClass().getName());
		out.writeUTF(this.keyClass.getName());
		out.writeUTF(this.valueClass.getName());
		this.configuration.write(out);
	}
39678
private void writeObject (ObjectOutputStream out) throws IOException {
		out.defaultWriteObject();
		out.writeUTF(charset.name());
	}