Skip to content

Instantly share code, notes, and snippets.

@winniehell
Created July 10, 2012 02:22
Show Gist options
  • Save winniehell/3080603 to your computer and use it in GitHub Desktop.
Save winniehell/3080603 to your computer and use it in GitHub Desktop.
DTN sending fix
final AutoCloseInputStream stream = new AutoCloseInputStream(pData);
try {
final FileChannel channel = stream.getChannel();
final MappedByteBuffer buf = channel.map(FileChannel.MapMode.READ_ONLY, 0, channel.size());
session.send(SERVER_EID, 100,
Charset.defaultCharset().decode(buf).toString());
}
finally {
stream.close();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment