Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
ByteArrayOutputStream.しかない場合にファイルオブジェクトを取得する方法を誰かが説明できますか? からファイルを作成する方法はByteArrayOutputStream?
ByteArrayOutputStream
FileOutputStreamとwriteToメソッドを使用してそれを行うことができます。
FileOutputStream
writeTo
ByteArrayOutputStream byteArrayOutputStream = getByteStreamMethod(); try(OutputStream outputStream = new FileOutputStream("thefilename")) { byteArrayOutputStream.writeTo(outputStream); }
ソース: 「Java で ByteArrayOutputStream からファイルを作成する」コード発明について