Может быть, наведёт на мысль:
import java.io.*;
public class PortableFile implements Serializable
{
private byte[] content;
String name;
public PortableFile( File file ) throws FileNotFoundException
{
this.name = file.getName();
this.content = new byte[ ( int )file.length() ];
try
{
FileInputStream fileInputStream = new FileInputStream( file );
fileInputStream.read( this.content, 0, ( int )file.length() );
fileInputStream.close();
}
catch( IOException e )
{
//
System.out.println( "IOException: " + e );
//
System.exit( 0 );
}
}
public String getName()
{
return this.name;
}
public int getLength()
{
return this.content.length;
}
public byte[] getBytes()
{
return this.content;
}
}
Здесь, надеюсь, всё очень просто.

... << RSDN@Home 1.0 beta 7a >>