Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Nicola Amadio
freud-java-serialization
Commits
77cd40e6
Commit
77cd40e6
authored
Dec 31, 2020
by
amadionix
Browse files
add other methods to convert int/long to uint_32; none of them work
parent
f8bfee84
Changes
11
Hide whitespace changes
Inline
Side-by-side
.idea/libraries/Maven__com_google_code_findbugs_jsr305_3_0_2.xml
0 → 100644
View file @
77cd40e6
<component
name=
"libraryTable"
>
<library
name=
"Maven: com.google.code.findbugs:jsr305:3.0.2"
>
<CLASSES>
<root
url=
"jar://$MAVEN_REPOSITORY$/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar!/"
/>
</CLASSES>
<JAVADOC>
<root
url=
"jar://$MAVEN_REPOSITORY$/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2-javadoc.jar!/"
/>
</JAVADOC>
<SOURCES>
<root
url=
"jar://$MAVEN_REPOSITORY$/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2-sources.jar!/"
/>
</SOURCES>
</library>
</component>
\ No newline at end of file
.idea/libraries/Maven__com_google_errorprone_error_prone_annotations_2_3_4.xml
0 → 100644
View file @
77cd40e6
<component
name=
"libraryTable"
>
<library
name=
"Maven: com.google.errorprone:error_prone_annotations:2.3.4"
>
<CLASSES>
<root
url=
"jar://$MAVEN_REPOSITORY$/com/google/errorprone/error_prone_annotations/2.3.4/error_prone_annotations-2.3.4.jar!/"
/>
</CLASSES>
<JAVADOC>
<root
url=
"jar://$MAVEN_REPOSITORY$/com/google/errorprone/error_prone_annotations/2.3.4/error_prone_annotations-2.3.4-javadoc.jar!/"
/>
</JAVADOC>
<SOURCES>
<root
url=
"jar://$MAVEN_REPOSITORY$/com/google/errorprone/error_prone_annotations/2.3.4/error_prone_annotations-2.3.4-sources.jar!/"
/>
</SOURCES>
</library>
</component>
\ No newline at end of file
.idea/libraries/Maven__com_google_guava_failureaccess_1_0_1.xml
0 → 100644
View file @
77cd40e6
<component
name=
"libraryTable"
>
<library
name=
"Maven: com.google.guava:failureaccess:1.0.1"
>
<CLASSES>
<root
url=
"jar://$MAVEN_REPOSITORY$/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar!/"
/>
</CLASSES>
<JAVADOC>
<root
url=
"jar://$MAVEN_REPOSITORY$/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1-javadoc.jar!/"
/>
</JAVADOC>
<SOURCES>
<root
url=
"jar://$MAVEN_REPOSITORY$/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1-sources.jar!/"
/>
</SOURCES>
</library>
</component>
\ No newline at end of file
.idea/libraries/Maven__com_google_guava_guava_30_0_jre.xml
0 → 100644
View file @
77cd40e6
<component
name=
"libraryTable"
>
<library
name=
"Maven: com.google.guava:guava:30.0-jre"
>
<CLASSES>
<root
url=
"jar://$MAVEN_REPOSITORY$/com/google/guava/guava/30.0-jre/guava-30.0-jre.jar!/"
/>
</CLASSES>
<JAVADOC>
<root
url=
"jar://$MAVEN_REPOSITORY$/com/google/guava/guava/30.0-jre/guava-30.0-jre-javadoc.jar!/"
/>
</JAVADOC>
<SOURCES>
<root
url=
"jar://$MAVEN_REPOSITORY$/com/google/guava/guava/30.0-jre/guava-30.0-jre-sources.jar!/"
/>
</SOURCES>
</library>
</component>
\ No newline at end of file
.idea/libraries/Maven__com_google_guava_listenablefuture_9999_0_empty_to_avoid_conflict_with_guava.xml
0 → 100644
View file @
77cd40e6
<component
name=
"libraryTable"
>
<library
name=
"Maven: com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava"
>
<CLASSES>
<root
url=
"jar://$MAVEN_REPOSITORY$/com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar!/"
/>
</CLASSES>
<JAVADOC>
<root
url=
"jar://$MAVEN_REPOSITORY$/com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava-javadoc.jar!/"
/>
</JAVADOC>
<SOURCES>
<root
url=
"jar://$MAVEN_REPOSITORY$/com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava-sources.jar!/"
/>
</SOURCES>
</library>
</component>
\ No newline at end of file
.idea/libraries/Maven__com_google_j2objc_j2objc_annotations_1_3.xml
0 → 100644
View file @
77cd40e6
<component
name=
"libraryTable"
>
<library
name=
"Maven: com.google.j2objc:j2objc-annotations:1.3"
>
<CLASSES>
<root
url=
"jar://$MAVEN_REPOSITORY$/com/google/j2objc/j2objc-annotations/1.3/j2objc-annotations-1.3.jar!/"
/>
</CLASSES>
<JAVADOC>
<root
url=
"jar://$MAVEN_REPOSITORY$/com/google/j2objc/j2objc-annotations/1.3/j2objc-annotations-1.3-javadoc.jar!/"
/>
</JAVADOC>
<SOURCES>
<root
url=
"jar://$MAVEN_REPOSITORY$/com/google/j2objc/j2objc-annotations/1.3/j2objc-annotations-1.3-sources.jar!/"
/>
</SOURCES>
</library>
</component>
\ No newline at end of file
.idea/libraries/Maven__org_checkerframework_checker_qual_3_5_0.xml
0 → 100644
View file @
77cd40e6
<component
name=
"libraryTable"
>
<library
name=
"Maven: org.checkerframework:checker-qual:3.5.0"
>
<CLASSES>
<root
url=
"jar://$MAVEN_REPOSITORY$/org/checkerframework/checker-qual/3.5.0/checker-qual-3.5.0.jar!/"
/>
</CLASSES>
<JAVADOC>
<root
url=
"jar://$MAVEN_REPOSITORY$/org/checkerframework/checker-qual/3.5.0/checker-qual-3.5.0-javadoc.jar!/"
/>
</JAVADOC>
<SOURCES>
<root
url=
"jar://$MAVEN_REPOSITORY$/org/checkerframework/checker-qual/3.5.0/checker-qual-3.5.0-sources.jar!/"
/>
</SOURCES>
</library>
</component>
\ No newline at end of file
freud-java-serialization.iml
View file @
77cd40e6
...
...
@@ -11,5 +11,12 @@
</content>
<orderEntry
type=
"inheritedJdk"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
<orderEntry
type=
"library"
name=
"Maven: com.google.guava:guava:30.0-jre"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: com.google.guava:failureaccess:1.0.1"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: com.google.code.findbugs:jsr305:3.0.2"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.checkerframework:checker-qual:3.5.0"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: com.google.errorprone:error_prone_annotations:2.3.4"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: com.google.j2objc:j2objc-annotations:1.3"
level=
"project"
/>
</component>
</module>
\ No newline at end of file
my-symbols/_nicola_test/idcm__nicola_test_12493.bin
View file @
77cd40e6
No preview for this file type
pom.xml
View file @
77cd40e6
...
...
@@ -19,5 +19,13 @@
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>
com.google.guava
</groupId>
<artifactId>
guava
</artifactId>
<version>
30.0-jre
</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
src/main/java/Main.java
View file @
77cd40e6
import
com.google.common.primitives.Ints
;
import
java.io.*
;
import
java.nio.ByteBuffer
;
import
java.util.Arrays
;
...
...
@@ -10,7 +12,7 @@ public class Main {
TestClassToSerialize
myObject
=
new
TestClassToSerialize
();
fillObject
(
myObject
);
createBinaryFile
(
myObject
);
readFile
();
//
readFile();
}
private
static
void
readFile
()
throws
IOException
{
...
...
@@ -54,21 +56,41 @@ public class Main {
private
static
void
writeObjectToFile
(
FileOutputStream
fos
,
TestClassToSerialize
myObject
)
throws
IOException
{
fos
.
write
(
longToBytes
(
myObject
.
getNameLen
()));
fos
.
write
(
myObject
.
getFname
().
getBytes
());
fos
.
write
(
longToBytes
(
myObject
.
getFeatureNamesCount
()));
//
fos.write(myObject.getFname().getBytes());
//
fos.write(longToBytes(myObject.getFeatureNamesCount()));
fos
.
close
();
}
public
static
byte
[]
intToByteArray
(
int
data
)
{
return
Ints
.
toByteArray
(
data
);
}
// public static final byte[] intToByteArray(int value) {
// return new byte[] {
// (byte)(value >>> 24),
// (byte)(value >>> 16),
// (byte)(value >>> 8),
// (byte)value};
// }
// public static byte[] intToByteArray( int data ) {
// byte[] result = new byte[4];
// result[0] = (byte) ((data & 0xFF000000) >> 24);
// result[1] = (byte) ((data & 0x00FF0000) >> 16);
// result[2] = (byte) ((data & 0x0000FF00) >> 8);
// result[3] = (byte) ((data & 0x000000FF) >> 0);
// return result;
// }
public
static
byte
[]
longToBytes
(
long
x
)
{
ByteBuffer
buffer
=
ByteBuffer
.
allocate
(
Long
.
BYTES
);
buffer
.
putLong
(
x
);
return
buffer
.
array
();
return
Arrays
.
copyOfRange
(
buffer
.
array
()
,
4
,
8
)
;
}
private
static
void
fillObject
(
TestClassToSerialize
myObject
)
{
myObject
.
setNameLen
(
1
2
);
myObject
.
setFname
(
"_
nicola_test
"
);
myObject
.
setFeatureNamesCount
(
1
);
myObject
.
setNameLen
(
1
5
);
myObject
.
setFname
(
"_
Z9test_loopPii
"
);
myObject
.
setFeatureNamesCount
(
4
);
// myObject.setVnlen(2);
// myObject.setVname("as");
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment