Re: Как передать файл по сети посредством RMI?
От: supersonic  
Дата: 24.06.03 17:10
Оценка: 2 (1)
Может быть, наведёт на мысль:

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 >>
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.