Package files

Examples of files.IndexedFile


  public void removeAllSharedFiles()
  {
    Iterator<IndexedFile> sharedFilesIterator = sharedFiles.iterator();
    while (sharedFilesIterator.hasNext())
    {
      IndexedFile file = sharedFilesIterator.next();
      sharedFilesIterator.remove();
      file.removeSharer(this);
    }
  }
View Full Code Here


{
  public void execute(ClientConnection connection, ObjectInputStream is,
      ObjectOutputStream os) throws IOException, ClassNotFoundException
  {
    SerializableFile file = (SerializableFile) is.readObject();
    IndexedFile indexedFile = getFileManager().retrieveIndexedFile(file);

    os.write(ClientServerProtocol.PROTOCOL_FILES);
    if (indexedFile == null)
    {
      os.write(ClientServerProtocol.Files.OP_INVALID_FILE);
      os.writeObject(file);
    }
    else
    {
      os.write(ClientServerProtocol.Files.OP_FILE_INFO);
      os.writeObject(file);
      os.writeLong(indexedFile.getChunkLength());
    }
  }
View Full Code Here

      ObjectOutputStream os) throws IOException, ClassNotFoundException
  {
    SerializableFile requestedFile = (SerializableFile) is.readObject();
    boolean addClientAsSource = is.readBoolean();

    IndexedFile serverFile = getFileManager().retrieveIndexedFile(requestedFile);

    if (serverFile == null)
    {
      os.write(ClientServerProtocol.PROTOCOL_FILES);
      os.write(ClientServerProtocol.Files.OP_INVALID_FILE);
      os.writeObject(requestedFile);
      return;
    }

    os.write(ClientServerProtocol.PROTOCOL_FILES);
    os.write(ClientServerProtocol.Files.OP_FILE_SOURCES);
    os.writeObject(requestedFile);
    serverFile.serializeStatus(connection.getClientId(), os);

    if (addClientAsSource)
    {
      getFileManager().addSharedFile(requestedFile, connection.getClientId());
    }
View Full Code Here

TOP

Related Classes of files.IndexedFile

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.