Creates a writer callback that writes some byte array to the target stream.

<p>This writer can be used many times.
@param data the bytes to write
@return the writer callback
350355
public static WriterCallback from(final byte[] data) {
    return new WriterCallback() {
      @Override
      public void write(OutputStream os) throws IOException {
        os.write(data);
      }
    };
  }
275751
public final ChannelFuture writeData(int id, int streamId, HttpData data, boolean endStream) {

        assert eventLoop().inEventLoop();

        if (closed) {
            ReferenceCountUtil.safeRelease(data);
            return newClosedSessionFuture();
        }

        return doWriteData(id, streamId, data, endStream);
    }
293238
public static StringBuffer encode(byte[] data)
	{
		int rem = data.length % 3;
		int num = data.length / 3;
		StringBuffer result = new StringBuffer();
		int p = 0;
		// int c=0;

		for (int i = 0; i < num; i++)
		{
			int b1 = (data[p] & 0xfc) >> 2;
			int b2 = (data[p] & 0x03) << 4 | (data[p + 1] & 0xf0) >> 4;
			int b3 = (data[p + 1] & 0x0f) << 2 | (data[p + 2] & 0xc0) >> 6;
			int b4 = data[p + 2] & 0x3f;

			result.append(b64encode(b1));
			result.append(b64encode(b2));
			result.append(b64encode(b3));
			result.append(b64encode(b4));

			p += 3;
			// c += 4;
		}

		switch (rem)
		{
			case 0:
				break;

			case 1:
			{
				int b1 = (data[p] & 0xfc) >> 2;
				int b2 = (data[p] & 0x03) << 4;

				result.append(b64encode(b1));
				result.append(b64encode(b2));
				result.append('=');
				result.append('=');
				break;
			}

			case 2:
			{
				int b1 = (data[p] & 0xfc) >> 2;
				int b2 = (data[p] & 0x03) << 4 | (data[p + 1] & 0xf0) >> 4;
				int b3 = (data[p + 1] & 0x0f) << 2;

				result.append(b64encode(b1));
				result.append(b64encode(b2));
				result.append(b64encode(b3));
				result.append('=');
				break;
			}
		}

		return result;
	}
882649
public static byte[] encode(final byte[] data) throws IOException {
        ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
        GZIPOutputStream gzOut = null;
        try {
            gzOut = new GZIPOutputStream(byteOut);
            gzOut.write(data);
            gzOut.close();
            byteOut.close();
            return byteOut.toByteArray();
        } finally {
            gzOut.close();
            byteOut.close();
        }
    }
773592
protected void write(OutputStream outputStream, String data, boolean terminate, int level) {
        try {
            if (data != null) {
                if (level > 0) {
                    outputStream.write(StringUtils.repeat("  ", level).getBytes(CS_UTF8));
                }
                
                outputStream.write(data.getBytes(CS_UTF8));
                
                if (terminate) {
                    outputStream.write("\n".getBytes());
                }
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
1302078
def write(self, data):
        

        if self.is_closing():
            return

        self._write_buffer += data

        if len(self._write_buffer) >= self._output_buffer_limit_high:
            self._protocol.pause_writing()

        if self._write_buffer:
            self._can_write.set()
922449
public void write(byte[] data) {
        for(int i=0;i<data.length;i++) {
            writeByte(data[i]);
        }
    }
369373
public static Payload create(CharSequence data) {
    return create(StandardCharsets.UTF_8.encode(CharBuffer.wrap(data)), null);
  }
906329
public QrCodeEncoder addBytes(byte[] data) {
		StringBuilder builder = new StringBuilder(data.length);
		for (int i = 0; i < data.length; i++) {
			builder.append((char)data[i]);
		}

		MessageSegment segment = new MessageSegment();
		segment.message = builder.toString();
		segment.data = data;
		segment.length = data.length;
		segment.mode = QrCode.Mode.BYTE;

		segment.encodedSizeBits += 4;
		segment.encodedSizeBits += 8*segment.length;

		segments.add(segment);

		return this;
	}
465464
protected void writeByteArray(ObjectOutput output, byte[] data) throws IOException {
        if (null == data || 0 == data.length) {
            output.writeInt(-1);
        } else {
            output.writeInt(data.length);
            output.write(data);
        }
    }
777338
public void setData(byte[] data) {
        byte[] copy = new byte[data.length];
        System.arraycopy(data, 0, copy, 0, data.length);
        this.data = copy;
    }
617525
function(data, encoding, callback) {
    if (this.error) {
      if (callback) {
        callback(error);
      }
      throw error;
    } else {
      return this.stream.write(data, encoding, callback);
    }
  }
400353
public void sendMessage(byte data)
    {
        try
        {
            out.write(data);
            out.flush();
        }
        catch (final IOException exception)
        {
            Verbose.exception(exception);
        }
    }
530180
private DataBuffer withDataBufferFactory(ByteBufHttpData data) {
        final byte[] dataArray = ByteBufUtil.getBytes(data.content());
        data.release();
        return delegate.wrap(dataArray);
    }
790281
public static String formatBytes (byte[] data) {
    // If the data exists, format it.
    if (data != null) {
      return formatBytes(data, 0, data.length, true);
    }
    // Otherwise, return an empty String as the overloaded method would have done.
    else {
      return "";
    }
  }
919786
private void write(final DataInputStream stream, final Writer outputWriter, final int numberOfBytes)
      throws IOException {
    final byte[] buf = new byte[65535];
    int lenRemaining = numberOfBytes;
    while (lenRemaining > 0) {
      final int len = stream.read(buf, 0, lenRemaining > 65535 ? 65535 : lenRemaining);
      if (len > 0) {
        outputWriter.write(new String(buf, 0, len, "UTF-8"));
        lenRemaining -= len;
      } else {
        break;
      }
    }
  }
1305185
public void write(byte[] data)
        throws IOException, IllegalStateException {
        LOG.trace("enter HttpConnection.write(byte[])");
        this.write(data, 0, data.length);
    }