-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6767616
commit 904818b
Showing
19 changed files
with
283 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/main/java/com/marcospassos/phpserializer/adapter/LongAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.marcospassos.phpserializer.adapter; | ||
|
||
import com.marcospassos.phpserializer.Context; | ||
import com.marcospassos.phpserializer.TypeAdapter; | ||
import com.marcospassos.phpserializer.Writer; | ||
|
||
/** | ||
* Adapter for {@code Long} values. | ||
* | ||
* @author Marcos Passos | ||
* @since 1.0 | ||
*/ | ||
public class LongAdapter implements TypeAdapter<Long> | ||
{ | ||
@Override | ||
public void write(Long value, Writer writer, Context context) | ||
{ | ||
writer.writeInteger(value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 24 additions & 2 deletions
26
src/main/java/com/marcospassos/phpserializer/adapter/StringAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,42 @@ | ||
package com.marcospassos.phpserializer.adapter; | ||
|
||
import java.nio.charset.Charset; | ||
import com.marcospassos.phpserializer.Context; | ||
import com.marcospassos.phpserializer.TypeAdapter; | ||
import com.marcospassos.phpserializer.Writer; | ||
|
||
/** | ||
* Adapter for handling strings. | ||
* Adapter for string type. | ||
* | ||
* @author Marcos Passos | ||
* @since 1.0 | ||
*/ | ||
public class StringAdapter implements TypeAdapter<String> | ||
{ | ||
/** | ||
* The charset. | ||
*/ | ||
private Charset charset; | ||
|
||
/** | ||
* Creates a adapter for strings encoded in UTF-8. | ||
*/ | ||
public StringAdapter() { | ||
this(Charset.forName("UTF-8")); | ||
} | ||
|
||
/** | ||
* Creates a adapter for strings encoded with the specified charset. | ||
* | ||
* @param charset | ||
*/ | ||
public StringAdapter(Charset charset) { | ||
this.charset = charset; | ||
} | ||
|
||
@Override | ||
public void write(String value, Writer writer, Context context) | ||
{ | ||
writer.writeString(value); | ||
writer.writeString(value, this.charset); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.