I am trying to write a function that takes File object, offset and byte array parameters and writes that byte array to a File object in Java.
So the function would look like
public void write(File file, long offset, byte[] data)
But the problem is that the offset parameter is long type, so I can't use write() function of OutputStream, which takes integer as an offset.
Unlike InputStream, which has skip(long), it seems OutputStream has no way to skip the first bytes of the file.
Is there a good way to solve this problem?
Thank you.
int
is 2,147,483,647. Are the arrays you want to write larger than +- 2GB? – Diploblasticoff
inOutputStream.write()
is about the array, not the stream/file (but I see there are some relevant answers already). – Diploblastic