• Post Reply Bookmark Topic Watch Topic
  • New Topic

what is mean by offset?

 
Nicky Eng
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is mean by offset in the code?


write
public void write(byte[] b,
int off,
int len)
throws IOExceptionWrites len bytes from the specified byte array starting at offset off to this file output stream.

Overrides:
write in class OutputStream
Parameters:
b - the data.
off - the start offset in the data.
len - the number of bytes to write.
Throws:
IOException - if an I/O error occurs.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Offset is the distance from the first byte. Offset 0 is the first byte, offset 1 is the 2nd byte, and so on. It's why computer geeks start counting at 0 instead of 1 for things like array indexes.
 
Nicky Eng
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you. now i remember i learnt it.

shame on me
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey, no problem. Keep having fun.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!