Skip to content

Commit

Permalink
Set length in usbfileoutputsream.close issue magnusja#126
Browse files Browse the repository at this point in the history
  • Loading branch information
magnusja committed Jan 13, 2018
1 parent 559975f commit 3a2654e
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 13 deletions.
5 changes: 2 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"

defaultConfig {
applicationId "com.github.mjdev.usbfileman"
Expand All @@ -26,8 +25,8 @@ android {
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:design:25.1.0'
compile 'com.android.support:appcompat-v7:25.4.0'
compile 'com.android.support:design:25.4.0'
compile project(':libaums')
compile project(':httpserver')
compile project(':storageprovider')
Expand Down
7 changes: 6 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ buildscript {
maven {
url 'https://dl.bintray.com/magnusja/maven'
}
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.android.tools.build:gradle:3.0.1'

classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
Expand Down Expand Up @@ -47,6 +51,7 @@ allprojects {
repositories {
jcenter()
maven { url 'https://dl.bintray.com/magnusja/maven' }
google()
}
}

Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Fri May 26 22:12:57 PDT 2017
#Fri Jan 12 22:53:10 PST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
3 changes: 1 addition & 2 deletions httpserver/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ configurations {

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"

defaultConfig {
minSdkVersion 16
Expand All @@ -40,7 +39,7 @@ dependencies {
compile 'com.koushikdutta.async:androidasync:2.+'

compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:support-annotations:25.1.0'
compile 'com.android.support:support-annotations:27.0.2'
compile project(':libaums')
}

Expand Down
1 change: 0 additions & 1 deletion javafs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apply plugin: 'com.android.library'

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"

defaultConfig {
minSdkVersion 16
Expand Down
5 changes: 2 additions & 3 deletions libaums/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ configurations {

android {
compileSdkVersion 26
buildToolsVersion "25.0.2"

defaultConfig {
minSdkVersion 16
Expand Down Expand Up @@ -56,8 +55,8 @@ dependencies {
testCompile 'org.xenei:junit-contracts:0.1.7'
testCompile 'org.mockito:mockito-core:2.7.22'

compile 'com.android.support:support-annotations:25.3.1'
javadocDeps 'com.android.support:support-annotations:25.3.1'
compile 'com.android.support:support-annotations:27.0.2'
javadocDeps 'com.android.support:support-annotations:27.0.2'
}

task bintray {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public void write(int oneByte) throws IOException {

@Override
public void close() throws IOException {
file.setLength(currentByteOffset);
file.close();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,16 @@ public void writeOffset() throws Exception {
assertEquals(10, byteBufferCaptor.getValue().remaining());
}


@Test
public void closeSetLength() throws Exception {
OutputStream os = new UsbFileOutputStream(file);

os.write(new byte[20]);
os.close();
verify(file).setLength(longCaptor.capture());

assertEquals(20, longCaptor.getValue().longValue());
}

}
1 change: 0 additions & 1 deletion storageprovider/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ configurations {

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"

defaultConfig {
minSdkVersion 16
Expand Down

0 comments on commit 3a2654e

Please sign in to comment.