集册 Java实例教程 使用write()方法写入字节

使用write()方法写入字节

欢马劈雪     最近更新时间:2020-01-02 10:19:05

468
使用write()方法写入字节
/** n o w  j a v a  . c o m 提 供 **/

import java.io.IOException;

import java.nio.file.Files;

import java.nio.file.Path;

import java.nio.file.Paths;


public class Main {

  public static void main(String[] args) {

    Path ball_path = Paths.get("C:/folder1/photos", "ball.png");


    byte[] ball_bytes = new byte[] { (byte) 0x89, (byte) 0x50, (byte) 0x4e,

        (byte) 0x47, (byte) 0x0d, (byte) 0x0a, (byte) 0x1a, (byte) 0x0a,

        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x0d, (byte) 0x49,

        (byte) 0x60, (byte) 0x82 };

展开阅读全文