Tabnine Logo
com.owncloud.android.lib.resources.files
Code IndexAdd Tabnine to your IDE (free)

How to use com.owncloud.android.lib.resources.files

Best Java code snippets using com.owncloud.android.lib.resources.files (Showing top 20 results out of 315)

origin: nextcloud/android-library

public SearchMethod(String uri, SearchInfo searchInfo) throws IOException {
  super(uri, searchInfo);
  setRequestHeader(HEADER_CONTENT_TYPE, HEADER_CONTENT_TYPE_VALUE);
  setRequestBody(createQuery());
}
origin: owncloud/android-library

/**
 * Reconstruct from parcel
 *
 * @param source The source parcel
 */
protected RemoteFile(Parcel source) {
  readFromParcel(source);
}
origin: owncloud/android-library

private void startRefresh() {
  ReadRemoteFolderOperation refreshOperation = new ReadRemoteFolderOperation(FileUtils.PATH_SEPARATOR);
  refreshOperation.execute(mClient, this, mHandler);
}

origin: nextcloud/android-library

  @Test
  public void testCreateNonExistingSubFolder() {
    String path = "/testFolder/1/2/3/4/5/";
    String top = "/testFolder/";

    assertTrue(new CreateFolderRemoteOperation(path, true).execute(client).isSuccess());

    // verify folder
    assertTrue(new ReadFolderRemoteOperation(path).execute(client).isSuccess());

    // remove folder
    assertTrue(new RemoveFileRemoteOperation(top).execute(client).isSuccess());
  }
}
origin: nextcloud/android-library

@Test
public void testUploadWithoutExistingChunksBig() {
  long length = 4 * chunkSize;
  List<Chunk> existingChunks = new ArrayList<>();
  List<Chunk> expectedMissingChunks = new ArrayList<>();
  expectedMissingChunks.add(new Chunk(0, 1023));
  expectedMissingChunks.add(new Chunk(1024, 2047));
  expectedMissingChunks.add(new Chunk(2048, 3071));
  expectedMissingChunks.add(new Chunk(3072, 4095));
  expectedMissingChunks.add(new Chunk(4096, 4096));
  assertTrue(test(existingChunks, expectedMissingChunks, chunkSize, length));
}
origin: nextcloud/android-library

@Test
public void testCreateFolderFailure() {
  String path = "/testFolder/";
  // create folder
  assertTrue(new CreateFolderRemoteOperation(path, true).execute(client).isSuccess());
  // create folder a second time will fail
  assertFalse(new CreateFolderRemoteOperation(path, true).execute(client).isSuccess());
  // remove folder
  assertTrue(new RemoveFileRemoteOperation(path).execute(client).isSuccess());
}
origin: nextcloud/android-library

/**
 * Performs the operation
 *
 * @param client Client object to communicate with the remote ownCloud server.
 */
@Override
protected RemoteOperationResult run(OwnCloudClient client) {
  RemoteOperationResult result;
  result = createFolder(client);
  if (!result.isSuccess() && mCreateFullPath &&
      RemoteOperationResult.ResultCode.CONFLICT == result.getCode()) {
    result = createParentFolder(FileUtils.getParentPath(mRemotePath), client);
    if (result.isSuccess()) {
      result = createFolder(client);    // second (and last) try
    }
  }
  return result;
}
origin: owncloud/android-library

private void startDownload() {
  File downFolder = new File(getCacheDir(), getString(R.string.download_folder_path));
  downFolder.mkdir();
  File upFolder = new File(getCacheDir(), getString(R.string.upload_folder_path));
  File fileToUpload = upFolder.listFiles()[0];
  String remotePath = FileUtils.PATH_SEPARATOR + fileToUpload.getName();
  DownloadRemoteFileOperation downloadOperation = new DownloadRemoteFileOperation(remotePath,
      downFolder.getAbsolutePath());
  downloadOperation.addDatatransferProgressListener(this);
  downloadOperation.execute(mClient, this, mHandler);
}
origin: nextcloud/android-library

  private boolean test(List<Chunk> existingChunks, List<Chunk> expectedMissingChunks, long chunkSize, long length) {
    ChunkedFileUploadRemoteOperation sut = new ChunkedFileUploadRemoteOperation(null, null, null, null, null, null,
                                          false);

    List<Chunk> missingChunks = sut.checkMissingChunks(existingChunks, length, chunkSize);

    assertEquals(expectedMissingChunks.size(), missingChunks.size());

    for (Chunk expectedMissingChunk : expectedMissingChunks) {
      assertTrue(missingChunks.contains(expectedMissingChunk));
    }

    return true;
  }
}
origin: owncloud/android-library

  /**
   * Checks if a file with the new name already exists.
   *
   * @return      'True' if the target path is already used by an existing file.
   */
  private boolean targetPathIsUsed(OwnCloudClient client) {
    ExistenceCheckRemoteOperation existenceCheckRemoteOperation =
      new ExistenceCheckRemoteOperation(mNewRemotePath, false, false);
    RemoteOperationResult exists = existenceCheckRemoteOperation.run(client);
    return exists.isSuccess();
  }
}
origin: nextcloud/android-library

private RemoteOperationResult createParentFolder(String parentPath, OwnCloudClient client) {
  RemoteOperation operation = new CreateFolderRemoteOperation(parentPath, mCreateFullPath);
  return operation.execute(client);
}
origin: owncloud/android-library

private void startRemoteDeletion() {
  File upFolder = new File(getCacheDir(), getString(R.string.upload_folder_path));
  File fileToUpload = upFolder.listFiles()[0];
  String remotePath = FileUtils.PATH_SEPARATOR + fileToUpload.getName();
  RemoveRemoteFileOperation removeOperation = new RemoveRemoteFileOperation(remotePath);
  removeOperation.execute(mClient, this, mHandler);
}
origin: owncloud/android-library

public RemoteFile() {
  resetData();
}
origin: owncloud/android-library

  private RemoteOperationResult createParentFolder(String parentPath, OwnCloudClient client) {
    RemoteOperation operation = new CreateRemoteFolderOperation(parentPath, mCreateFullPath);
    return operation.execute(client);
  }
}
origin: nextcloud/android-library

@Test
public void testCreateFolderSuccess() {
  String path = "/testFolder/";
  // create folder
  assertTrue(new CreateFolderRemoteOperation(path, true).execute(client).isSuccess());
  // verify folder
  assertTrue(new ReadFolderRemoteOperation(path).execute(client).isSuccess());
  // remove folder
  assertTrue(new RemoveFileRemoteOperation(path).execute(client).isSuccess());
}
origin: nextcloud/android-library

@Test
public void testUploadChunksMissingChunks2() {
  long length = 2 * chunkSize;
  List<Chunk> existingChunks = new ArrayList<>();
  existingChunks.add(new Chunk(50, 1023));
  existingChunks.add(new Chunk(1028, 1100));
  List<Chunk> expectedMissingChunks = new ArrayList<>();
  expectedMissingChunks.add(new Chunk(0, 49));
  expectedMissingChunks.add(new Chunk(1024, 1027));
  expectedMissingChunks.add(new Chunk(1101, 2048));
  assertTrue(test(existingChunks, expectedMissingChunks, chunkSize, length));
}
origin: nextcloud/android-library

@Test
public void testUploadChunksMissingChunks() {
  long length = 2 * chunkSize;
  List<Chunk> existingChunks = new ArrayList<>();
  existingChunks.add(new Chunk(0, 1023));
  existingChunks.add(new Chunk(1028, 1100));
  List<Chunk> expectedMissingChunks = new ArrayList<>();
  expectedMissingChunks.add(new Chunk(1024, 1027));
  expectedMissingChunks.add(new Chunk(1101, 2048));
  assertTrue(test(existingChunks, expectedMissingChunks, chunkSize, length));
}
origin: nextcloud/android-library

@Test
public void testUploadWithoutExistingChunksSmallChunks() {
  long chunkSize = 512;
  long length = 4 * chunkSize;
  List<Chunk> existingChunks = new ArrayList<>();
  List<Chunk> expectedMissingChunks = new ArrayList<>();
  expectedMissingChunks.add(new Chunk(0, 511));
  expectedMissingChunks.add(new Chunk(512, 1023));
  expectedMissingChunks.add(new Chunk(1024, 1535));
  expectedMissingChunks.add(new Chunk(1536, 2047));
  expectedMissingChunks.add(new Chunk(2048, 2048));
  assertTrue(test(existingChunks, expectedMissingChunks, chunkSize, length));
}
origin: nextcloud/android-library

@Test
public void testChunksSmallSizeMissingChunks() {
  long chunkSize = 512;
  long length = 4 * chunkSize;
  List<Chunk> existingChunks = new ArrayList<>();
  existingChunks.add(new Chunk(50, 89));
  existingChunks.add(new Chunk(551, 580));
  List<Chunk> expectedMissingChunks = new ArrayList<>();
  expectedMissingChunks.add(new Chunk(0, 49));
  expectedMissingChunks.add(new Chunk(90, 550));
  expectedMissingChunks.add(new Chunk(581, 1092));
  expectedMissingChunks.add(new Chunk(1093, 1604));
  expectedMissingChunks.add(new Chunk(1605, 2048));
  assertTrue(test(existingChunks, expectedMissingChunks, chunkSize, length));
}
origin: nextcloud/android-library

@Test
public void testUploadWithoutExistingChunks() {
  long length = 2 * chunkSize;
  List<Chunk> existingChunks = new ArrayList<>();
  List<Chunk> expectedMissingChunks = new ArrayList<>();
  expectedMissingChunks.add(new Chunk(0, 1023));
  expectedMissingChunks.add(new Chunk(1024, 2047));
  expectedMissingChunks.add(new Chunk(2048, 2048));
  assertTrue(test(existingChunks, expectedMissingChunks, chunkSize, length));
}
com.owncloud.android.lib.resources.files

Most used classes

  • Chunk
  • ChunkedFileUploadRemoteOperation
  • CreateFolderRemoteOperation
    Remote operation performing the creation of a new folder in the ownCloud server.
  • DownloadRemoteFileOperation
    Remote operation performing the download of a remote file in the ownCloud server.
  • FileUtils
  • ReadRemoteFolderOperation,
  • RemoteFile,
  • RemoveRemoteFileOperation,
  • UploadRemoteFileOperation,
  • ChunkedFileUploadRemoteOperationTest,
  • CopyFileRemoteOperation,
  • CreateRemoteFolderOperation,
  • DownloadFileRemoteOperation,
  • ExistenceCheckRemoteOperation,
  • MoveFileRemoteOperation,
  • MoveRemoteFileOperation,
  • ReadFileVersionsRemoteOperation,
  • RemoveFileRemoteOperation,
  • RenameRemoteFileOperation
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now